Skip to content

Unicode string literals formatted incorrectly #120

@marcusklaas

Description

@marcusklaas

Input:

fn main() {
    "☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃"
}

Output:

fn main() {
    "\u{2603}\u{2603}\u{2603}\u{2603}\u{2603}\u{2603}\u{2603}\u{2603}\u{2603}\u{2603}\u{2603}\u{260\⏎
     3}\u{2603}\u{2603}\u{2603}\u{2603}\u{2603}\u{2603}\u{2603}\u{2603}\u{2603}\u{2603}\u{2603}\u{2\⏎
     603}\u{2603}\u{2603}\u{2603}\u{2603}\u{2603}\u{2603}\u{2603}\u{2603}\u{2603}\u{2603}\u{2603}\u\⏎
     {2603}\u{2603}\u{2603}\u{2603}\u{2603}\u{2603}\u{2603}\u{2603}\u{2603}\u{2603}\u{2603}\u{2603}\⏎
     \u{2603}\u{2603}\u{2603}\u{2603}\u{2603}\u{2603}\u{2603}\u{2603}\u{2603}\u{2603}\u{2603}\u{260\⏎
     3}\u{2603}\u{2603}\u{2603}\u{2603}\u{2603}\u{2603}\u{2603}\u{2603}\u{2603}\u{2603}\u{2603}\u{2\⏎
     603}\u{2603}\u{2603}\u{2603}\u{2603}\u{2603}\u{2603}\u{2603}\u{2603}\u{2603}\u{2603}\u{2603}\u\⏎
     {2603}\u{2603}\u{2603}\u{2603}\u{2603}\u{2603}\u{2603}\u{2603}\u{2603}\u{2603}\u{2603}\u{2603}\⏎
     \u{2603}\u{2603}\u{2603}\u{2603}\u{2603}\u{2603}\u{2603}\u{2603}\u{2603}\u{2603}\u{2603}\u{260\⏎
     3}\u{2603}\u{2603}\u{2603}\u{2603}\u{2603}\u{2603}\u{2603}\u{2603}\u{2603}\u{2603}\u{2603}\u{2\⏎
     603}\u{2603}\u{2603}"
}

I believe there is already a FIXME for this in the code, but it may be good to have an issue and test case.

As an aside, why do we call escape_default on string literals?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions