-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Recover impl<T ?Sized>
correctly
#111449
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Recover impl<T ?Sized>
correctly
#111449
Conversation
In my opinion every time a parser error special case causes a worse error than the generic "expected, found" error that's a bug and should be fixed. I will take a look later. |
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.
I don't exactly love the change but I think it's an improvement that, when added with enough comments clarifying that it's not necessary (ideally also inside the matches!
), is an okay addition to the parser.
@@ -453,6 +453,7 @@ impl<'a> Parser<'a> { | |||
// `<` (LIFETIME|IDENT) `:` - generic parameter with bounds | |||
// `<` (LIFETIME|IDENT) `=` - generic parameter with a default | |||
// `<` const - generic const parameter | |||
// `<` IDENT `?` - RECOVERY for `impl<T ?Bound` missing a `:` |
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.
Could you add a comment here on why we need the special case here? That the parser likes to parse T?
as Option<T>
.
1d3c676
to
a5763ff
Compare
@rustbot ready |
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.
r=me
@bors r=Nilstrieb rollup |
…ics-correctly, r=Nilstrieb Recover `impl<T ?Sized>` correctly Fixes rust-lang#111327 r? `@Nilstrieb` but you can re-roll Alternatively, happy to close this if we're okay with just saying "sorry rust-lang#111327 is just a poor side-effect of parser ambiguity" 🤷
…ics-correctly, r=Nilstrieb Recover `impl<T ?Sized>` correctly Fixes rust-lang#111327 r? ``@Nilstrieb`` but you can re-roll Alternatively, happy to close this if we're okay with just saying "sorry rust-lang#111327 is just a poor side-effect of parser ambiguity" 🤷
…ics-correctly, r=Nilstrieb Recover `impl<T ?Sized>` correctly Fixes rust-lang#111327 r? ```@Nilstrieb``` but you can re-roll Alternatively, happy to close this if we're okay with just saying "sorry rust-lang#111327 is just a poor side-effect of parser ambiguity" 🤷
Rollup of 10 pull requests Successful merges: - rust-lang#111428 (refactor(resolve): clean up the early error return caused by non-call) - rust-lang#111449 (Recover `impl<T ?Sized>` correctly) - rust-lang#111572 (Document that `missing_copy_implementations` and `missing_debug_implementations` only apply to public items.) - rust-lang#111602 (Suppress "erroneous constant used" for constants tainted by errors) - rust-lang#111605 (fixup version placeholder for `cfi_encoding` feature) - rust-lang#111607 (Add clubby789 to the bootstrap review rotation) - rust-lang#111614 (Add more interesting nonsense to weird-exprs.rs) - rust-lang#111617 (Fixed typo) - rust-lang#111620 (Add eholk back to compiler-contributors reviewers) - rust-lang#111621 (Fix release date of 1.58.1 in release notes.) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Fixes #111327
r? @Nilstrieb but you can re-roll
Alternatively, happy to close this if we're okay with just saying "sorry #111327 is just a poor side-effect of parser ambiguity" 🤷