-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Make most lexer errors non-fatal #14388
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
Conversation
c: char) | ||
-> ! { | ||
let mut m = m; | ||
fn fatal_span_char<S: StrAllocating>(rdr: &mut StringReader, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The StrAllocating trait is mostly just an implementation detail, and it's kinda sad to see it used here for this (maybe not a pattern we want to promote). Can this take &str
for the same level of convenience?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It could. I started with StrAllocating
because I hadn't vetted every callsite to see if any allocated. It turns out none do. I'll go ahead and make the change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FWIW, my other thought was taking IntoMaybeOwned
, but that would just end up being a proxy for StrAllocating
because it would end up being let mut m = m.into_maybe_owned().into_strbuf()
.
Most errors that arise in the lexer can be recovered from. This allows for more than one syntax error to be reported at a time.
Updated with @alexcrichton suggestion. |
mmmm I love me some non-fatal errors |
…chton Most errors that arise in the lexer can be recovered from. This allows for more than one syntax error to be reported at a time.
Follow-up of rust-lang/rust-clippy#11421. I can't yet make the annotations mandatory because there is an issue with `tests/ui-internal/custom_ice_message.rs`: the error message is not emitted as JSON, meaning that we can't match it with `ui_test`. I need to check if it's a bug in rustc or if `ui_test` needs to handle this case somehow. changelog: Add missing tests annotations for `ui-internal` r? @flip1995
Most errors that arise in the lexer can be recovered from. This allows
for more than one syntax error to be reported at a time.