Commit Graph

23 Commits

Author SHA1 Message Date
Michael Goulet 1d40d4c4f4 Fix precise capturing suggestion for hidden type when APITs are involved 2024-07-17 10:52:13 -04:00
Michael Goulet 03bee1e1e5 Suggest using precise capturing for hidden type that captures region 2024-07-11 14:01:29 -04:00
Michael Goulet 3bc3247200 Move binder and polarity parsing into parse_generic_ty_bound 2024-06-28 19:40:31 -04:00
Michael Goulet 6521c3971d Deny use<> for RPITITs 2024-06-24 12:03:09 -04:00
Michael Goulet dd557d8c37 Add a test demonstrating that RPITITs cant use precise capturing 2024-06-20 12:04:59 -04:00
Michael Goulet 227374714f Delay a bug and mark precise_capturing as not incomplete 2024-06-17 22:35:25 -04:00
Michael Goulet 2e03130e11 Detect duplicates 2024-06-17 22:35:25 -04:00
Michael Goulet f66558d2bf Add tests for illegal use bound syntax 2024-06-17 22:35:25 -04:00
Michael Goulet b1efe1ab5d Rework precise capturing syntax 2024-06-17 22:35:25 -04:00
Michael Goulet 68bd001c00 Make parse_seq_to_before_tokens take expected/nonexpected tokens, use in parse_precise_capturing_syntax 2024-06-17 22:35:25 -04:00
Michael Goulet 052de1da4f And finally add tests 2024-05-13 23:57:56 -04:00
Michael Goulet 1529c661e4 Warn against redundant use<...> 2024-05-13 23:57:56 -04:00
Matthias Krüger afb6c4681a Rollup merge of #124169 - compiler-errors:parser-fatal, r=oli-obk
Don't fatal when calling `expect_one_of` when recovering arg in `parse_seq`

In `parse_seq`, when parsing a sequence of token-separated items, if we don't see a separator, we try to parse another item eagerly in order to give a good diagnostic and recover from a missing separator:
https://github.com/rust-lang/rust/blob/d1a0fa5ed3ffe52d72f761d3c95cbeb0a9cdfe66/compiler/rustc_parse/src/parser/mod.rs#L900-L901

If parsing the item itself calls `expect_one_of`, then we will fatal because of #58903:
https://github.com/rust-lang/rust/blob/d1a0fa5ed3ffe52d72f761d3c95cbeb0a9cdfe66/compiler/rustc_parse/src/parser/mod.rs#L513-L516

For `precise_capturing` feature I implemented, we do end up calling `expected_one_of`:
https://github.com/rust-lang/rust/blob/d1a0fa5ed3ffe52d72f761d3c95cbeb0a9cdfe66/compiler/rustc_parse/src/parser/ty.rs#L712-L714

This leads the compiler to fatal *before* having emitted the first error, leading to absolutely no useful information for the user about what happened in the parser.

This PR makes it so that we stop doing that.

Fixes #124195
2024-04-23 20:17:51 +02:00
Michael Goulet 57085a06d9 Explicitly mention Self 2024-04-20 11:39:43 -04:00
Michael Goulet fa0428c9d0 Flip spans for precise capturing syntax not capturing a ty/ct param 2024-04-20 10:35:04 -04:00
Michael Goulet 5daf58ffc1 Fix capturing duplicated lifetimes via parent 2024-04-19 14:12:21 -04:00
Michael Goulet 2ef15523c1 Don't fatal when calling expect_one_of when recovering arg in parse_seq 2024-04-19 13:12:20 -04:00
Michael Goulet ac7651ccaf More polishing 2024-04-15 16:45:48 -04:00
Michael Goulet 52c6b101ea Use a path instead of an ident (and stop manually resolving) 2024-04-15 16:45:26 -04:00
Michael Goulet ce8961039e Some ordering and duplication checks 2024-04-15 16:45:26 -04:00
Michael Goulet 02d7317af2 Add hir::Node::PreciseCapturingNonLifetimeArg 2024-04-15 16:45:25 -04:00
Michael Goulet 42ba57c013 Validation and other things 2024-04-15 16:45:01 -04:00
Michael Goulet 647b672f16 Begin AST lowering for precise captures 2024-04-15 16:45:01 -04:00