Skip to content

missing diagnostic #124195

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

Closed
matthiaskrgr opened this issue Apr 20, 2024 · 1 comment · Fixed by #124169
Closed

missing diagnostic #124195

matthiaskrgr opened this issue Apr 20, 2024 · 1 comment · Fixed by #124169
Labels
A-diagnostics Area: Messages for errors, warnings, and lints C-bug Category: This is a bug. F-precise_capturing `#![feature(precise_capturing)]`

Comments

@matthiaskrgr
Copy link
Member

I tried this code:

fn constant<const C: usize>() -> impl use< Sized {}

I expected to see this happen:
anything

Instead, this happened:
nothing

Meta

rustc --version --verbose:

rustc 1.79.0-nightly (f9b161492 2024-04-19)
binary: rustc
commit-hash: f9b16149208c8a8a349c32813312716f6603eb6f
commit-date: 2024-04-19
host: x86_64-unknown-linux-gnu
release: 1.79.0-nightly
LLVM version: 18.1.4
@matthiaskrgr matthiaskrgr added C-bug Category: This is a bug. F-precise_capturing `#![feature(precise_capturing)]` labels Apr 20, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Apr 20, 2024
@matthiaskrgr matthiaskrgr added the A-diagnostics Area: Messages for errors, warnings, and lints label Apr 20, 2024
@matthiaskrgr
Copy link
Member Author

The problem here is that the compilation fails, however rustc does not issue any sort of diagnostic to tell the user what went wrong.

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Apr 23, 2024
…i-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 rust-lang#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 rust-lang#124195
@bors bors closed this as completed in afb6c46 Apr 23, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Apr 23, 2024
Rollup merge of rust-lang#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 rust-lang#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 rust-lang#124195
@saethlin saethlin removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Apr 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints C-bug Category: This is a bug. F-precise_capturing `#![feature(precise_capturing)]`
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants