Skip to content

Remove \xXX char escapes from the language #312

Closed
@rust-highfive

Description

@rust-highfive

Issue by Valloric
Saturday Mar 08, 2014 at 21:19 GMT

For earlier discussion, see rust-lang/rust#12769

This issue was labelled with: B-RFC in the Rust repository


\xXX is very misleading in Rust since it actually works exactly like \u00XX instead of the way it works in C, C++ and other languages. Example:

// this FAILS because left is [195, 191]
assert_eq!( bytes!( "\xFF"), bytes!( 255 ) ); 
// this SUCCEEDS
assert_eq!( bytes!( "\xFF"), bytes!( "\u00FF" ) );  

I understand the reasoning behind this (Rust strings are always UTF-8), but then \xXX shouldn't exist in the language. It brings nothing but confusion and it's functionality as implemented is the same as \u00XX.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions