Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

std::chars::Char::escape_unicode generates old-style \u and \U escapes, breaking syntax::print #19811

Closed
emk opened this issue Dec 13, 2014 · 1 comment · Fixed by #19885 or #19977
Closed
Labels
E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added.

Comments

@emk
Copy link
Contributor

emk commented Dec 13, 2014

CC @pnkfelix, #19739.

Thank you for your work on the Unicode escape migration! This is probably already on your to-do list, but I thought I'd submit a test-case just to be safe.

The following test case:

fn main() {
    let mut escaped = String::from_str("");
    for c in '\u{10401}'.escape_unicode() {
        escaped.push(c);
    }
    assert_eq!("\\u{10401}", escaped);
}

…gives us:

assertion failed: `(left == right) && (right == left)` (left: `\u{10401}`, right: `\U00010401`)

Among other things, this causes issues for syntax::print and rust-peg, as described in kevinmehall/rust-peg#34.

alexcrichton added a commit to alexcrichton/rust that referenced this issue Dec 16, 2014
This changes the `escape_unicode` method on a `char` to use the new style of
unicode escapes in the language.

Closes rust-lang#19811
Closes rust-lang#19879
brson added a commit that referenced this issue Dec 16, 2014
This changes the `escape_unicode` method on a `char` to use the new style of
unicode escapes in the language.

Closes #19811
Closes #19879
alexcrichton added a commit to alexcrichton/rust that referenced this issue Dec 17, 2014
This changes the `escape_unicode` method on a `char` to use the new style of
unicode escapes in the language.

Closes rust-lang#19811
Closes rust-lang#19879
@pnkfelix
Copy link
Member

reopening and tagging as E-needstest.

@pnkfelix pnkfelix reopened this Dec 18, 2014
@pnkfelix pnkfelix added the E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. label Dec 18, 2014
pnkfelix added a commit to pnkfelix/rust that referenced this issue Dec 18, 2014
alexcrichton added a commit to alexcrichton/rust that referenced this issue Dec 21, 2014
Add regression test for Issue 19811.

(Thanks for @emk for providing this.)

Fix rust-lang#19811.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added.
Projects
None yet
2 participants