Skip to content

Assert well-formedness of spans #47504

Description

@estebank

rustc currently has peppered throughout the codebase some checks for "backwards spans", spans where their end is earlier than their start. I believe that the current approach of actively checking for this and not fail is very reasonable in beta and stable rustc, but in nightly builds I would like to have an assertion so that we expose this incorrectly formatted spans so that the underlying cause can be fixed.

This might take the form of a simple assert and ICEing (not my preference, but it would certainly bring attention to the problem) to generating a diagnostic error and emitting it, allowing the compiler to continue working, but making the problem visible to anyone using the nightly compiler, with text prompting a report in this issue tracker. If we go down the later route, it probably should be a warning, so that anyone using the nightly compiler in production isn't stopped from using it due to a rustc bug.

Activity

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

Metadata

Metadata

Assignees

Labels

A-diagnosticsArea: Messages for errors, warnings, and lintsC-enhancementCategory: An issue proposing an enhancement or a PR with one.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions