Skip to content

Bare CR allowed in code causing terrible spans #16480

Description

@SiegeLord

E.g. consider this code (save it to a file with CR line endings):

fn main() {
    let a = 0;
}

Error:

test.rs:1:18: 1:23 error: cannot determine a type for this local variable: cannot determine the type of this integer; add a suffix to specify the type explicitly [E0102]
}est.rs:let a = 0;) {
                            ^~~~~
error: aborting due to previous error

I'm pretty sure this did not used to happen.

I suggest disallowing bare CRs rather than fixing this span issue.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsA-grammarArea: The grammar of RustC-bugCategory: This is a bug.E-mediumCall for participation: Medium difficulty. Experience needed to fix: Intermediate.P-lowLow priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.T-langRelevant to the language team

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions