Skip to content

bad span on character literal errors #9149

Closed
@metajack

Description

@metajack

When reporting the span for the error it chooses the previous line. This is quite confusing. The error here is that the '\U...' syntax takes exaclty 8 hex digits and 7 are provided.

This test program:

fn main() {
    let c = 'a';
    match c {
        'a' => (),
        'b' => (),
        '\U0123456' => ()
    }
}

produces this output from rustc

$ rustc badspan.rs 
badspan.rs:5:17: 5:18 error: illegal numeric character escape: 39
badspan.rs:5         'b' => (),
                              ^

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