Repository navigation
Recover missing turbofish for lifetime arguments in expression position - #162749
Conversation
|
The parser was modified, potentially altering the grammar of (stable) Rust cc @fmease |
|
r? @chenyukang rustbot has assigned @chenyukang. Use Why was this reviewer chosen?The reviewer was selected based on:
|
There was a problem hiding this comment.
I need to do a more in-depth review, as I have some mild concerns about increasing the size of the parser, but the results look reasonable so far. I'll look at this again later this week if the assigned reviewer doesn't manage to get the time before then.
|
Reminder, once the PR becomes ready for a review, use |
acf53ca to
ce2a12a
Compare
This comment has been minimized.
This comment has been minimized.
|
@rustbot ready |
This comment has been minimized.
This comment has been minimized.
ce2a12a to
2e5a236
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
r? @estebank since you already take review :) |
turbofish for lifetime arguments in expression position
2e5a236 to
2b3bcf9
Compare
This comment has been minimized.
This comment has been minimized.
2b3bcf9 to
6836140
Compare
This comment has been minimized.
This comment has been minimized.
6836140 to
976f9ba
Compare
This comment has been minimized.
This comment has been minimized.
a122d5d to
ebca075
Compare
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
|
Thanks for your patience on this one. I think the final version ended up much better than the first version :) @bors r+ |
…rcote Recover missing `turbofish` for `lifetime` arguments in expression position Fixes rust-lang#162656. `Struct<'a> { .. }` and `f<'_>()` were parsed as a `<` comparison whose RHS is a label, producing a cascade of unrelated errors. `parse_path_segment` now accepts `<` followed by a lifetime and `>`/`,` in expression paths, emits one "use `::<...>`" suggestion, and parses the args normally.Since the recovery is inside the path parser, `path.span` and chained forms (`::new()`, `.method()`, `?`) work without AST fix-ups or new `Parser` state; it is guarded by `may_recover()`. cc @estebank
Rollup of 9 pull requests Successful merges: - #162749 (Recover missing `turbofish` for `lifetime` arguments in expression position) - #164170 (Prefer WriteConsoleW for stdout on Windows) - #164255 (test DSL eagerly handle false constraints) - #163230 (Document zero-sized allocations properly for `Box` and `Vec`) - #163940 (Parse move exprs as a bottom expr instead of a prefix expr) - #164219 (Windows FileExt trait doesn't need to handle ErrorKind::Interrupted; test improvements for same) - #164220 (Test the interaction between `--remap-path-prefix` and doctests) - #164266 (rustdoc: Improvements for `rustc_must_implement_one_of`) - #164278 (Output remapped paths in rustdoc JSON with the `documentation` scope)
…rcote Recover missing `turbofish` for `lifetime` arguments in expression position Fixes rust-lang#162656. `Struct<'a> { .. }` and `f<'_>()` were parsed as a `<` comparison whose RHS is a label, producing a cascade of unrelated errors. `parse_path_segment` now accepts `<` followed by a lifetime and `>`/`,` in expression paths, emits one "use `::<...>`" suggestion, and parses the args normally.Since the recovery is inside the path parser, `path.span` and chained forms (`::new()`, `.method()`, `?`) work without AST fix-ups or new `Parser` state; it is guarded by `may_recover()`. cc @estebank
…uwer Rollup of 11 pull requests Successful merges: - #162749 (Recover missing `turbofish` for `lifetime` arguments in expression position) - #164170 (Prefer WriteConsoleW for stdout on Windows) - #164255 (test DSL eagerly handle false constraints) - #163230 (Document zero-sized allocations properly for `Box` and `Vec`) - #163940 (Parse move exprs as a bottom expr instead of a prefix expr) - #164219 (Windows FileExt trait doesn't need to handle ErrorKind::Interrupted; test improvements for same) - #164220 (Test the interaction between `--remap-path-prefix` and doctests) - #164266 (rustdoc: Improvements for `rustc_must_implement_one_of`) - #164272 (Add regression test for #155977) - #164287 (Add regression test for hang in overlap check with GAT alias) - #164301 (fix issue number for feature(unsized_const_params))
…rcote Recover missing `turbofish` for `lifetime` arguments in expression position Fixes rust-lang#162656. `Struct<'a> { .. }` and `f<'_>()` were parsed as a `<` comparison whose RHS is a label, producing a cascade of unrelated errors. `parse_path_segment` now accepts `<` followed by a lifetime and `>`/`,` in expression paths, emits one "use `::<...>`" suggestion, and parses the args normally.Since the recovery is inside the path parser, `path.span` and chained forms (`::new()`, `.method()`, `?`) work without AST fix-ups or new `Parser` state; it is guarded by `may_recover()`. cc @estebank
…rcote Recover missing `turbofish` for `lifetime` arguments in expression position Fixes rust-lang#162656. `Struct<'a> { .. }` and `f<'_>()` were parsed as a `<` comparison whose RHS is a label, producing a cascade of unrelated errors. `parse_path_segment` now accepts `<` followed by a lifetime and `>`/`,` in expression paths, emits one "use `::<...>`" suggestion, and parses the args normally.Since the recovery is inside the path parser, `path.span` and chained forms (`::new()`, `.method()`, `?`) work without AST fix-ups or new `Parser` state; it is guarded by `may_recover()`. cc @estebank
…uwer Rollup of 17 pull requests Successful merges: - #162749 (Recover missing `turbofish` for `lifetime` arguments in expression position) - #164165 (Add a new `rustc_show_spans` internal attribute) - #164170 (Prefer WriteConsoleW for stdout on Windows) - #164208 (Implement better resolution for delegation `Self` mapping field) - #164255 (test DSL eagerly handle false constraints) - #163230 (Document zero-sized allocations properly for `Box` and `Vec`) - #163442 (Fix fudging) - #163940 (Parse move exprs as a bottom expr instead of a prefix expr) - #164079 (document some quirks around directory symlinks on Windows) - #164178 (Fix `diagnostic::on_unknown` format placeholder for paths in expressions and type paths) - #164219 (Windows FileExt trait doesn't need to handle ErrorKind::Interrupted; test improvements for same) - #164266 (rustdoc: Improvements for `rustc_must_implement_one_of`) - #164272 (Add regression test for #155977) - #164287 (Add regression test for hang in overlap check with GAT alias) - #164292 (Remove the `span_use_eq_ctxt` lint) - #164301 (fix issue number for feature(unsized_const_params)) - #164309 (point at the opaque when its hidden type cannot be inferred)
Rollup merge of #162749 - raushan728:issues/162656, r=nnethercote Recover missing `turbofish` for `lifetime` arguments in expression position Fixes #162656. `Struct<'a> { .. }` and `f<'_>()` were parsed as a `<` comparison whose RHS is a label, producing a cascade of unrelated errors. `parse_path_segment` now accepts `<` followed by a lifetime and `>`/`,` in expression paths, emits one "use `::<...>`" suggestion, and parses the args normally.Since the recovery is inside the path parser, `path.span` and chained forms (`::new()`, `.method()`, `?`) work without AST fix-ups or new `Parser` state; it is guarded by `may_recover()`. cc @estebank
View all comments
Fixes #162656.
Struct<'a> { .. }andf<'_>()were parsed as a<comparison whose RHS is a label, producing a cascade of unrelated errors.parse_path_segmentnow accepts<followed by a lifetime and>/,in expression paths, emits one "use::<...>" suggestion, and parses the args normally.Since the recovery is inside the path parser,path.spanand chained forms (::new(),.method(),?) work without AST fix-ups or newParserstate; it is guarded bymay_recover().cc @estebank