-
Notifications
You must be signed in to change notification settings - Fork 13.4k
ICE: rustfmt: self.stashed_diagnostics.is_empty()
#121450
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
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
A-rustfmt
Area: Rustfmt
C-bug
Category: This is a bug.
I-ICE
Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Comments
I suspect this is related to #121129 cc @nnethercote |
tests/ui/suggestions/unnamable-types.rs // Test that we do not suggest to add type annotations for unnamable types.
#![crate_type="lib"]
#![feature(coroutines)]
const A = 5;
//~^ ERROR: missing type for `const` item
//~| HELP: provide a type for the constant
static B: _ = "abc";
//~^ ERROR: the placeholder `_` is not allowed within types on item signatures for static variables
//~| NOTE: not allowed in type signatures
//~| HELP: replace with the correct type
// FIXME: this should also suggest a function pointer, as the closure is non-capturing
const C: _ = || 42;
//~^ ERROR: the placeholder `_` is not allowed within types on item signatures for constants
//~| NOTE: not allowed in type signatures
//~| NOTE: however, the inferred type
struct S<T> { t: T }
const D = S { t: { let i = 0; move || -> i32 { i } } };
//~^ ERROR: missing type for `const` item
//~| NOTE: however, the inferred type
fn foo() -> i32 { 42 }
const E = foo;
//~^ ERROR: missing type for `const` item
//~| HELP: provide a type for the constant
const F = S { t: foo };
//~^ ERROR: missing type for `const` item
//~| HELP: provide a type for the constant
const G = || -> i32 { yield 0; return 1; };
//~^ ERROR: missing type for `const` item
//~| NOTE: however, the inferred type |
Very likely. I'll take a look soon. |
nnethercote
added a commit
to nnethercote/rust
that referenced
this issue
Feb 23, 2024
Commit 72b172b in rust-lang#121206 changed things so that `emit_stashed_diagnostics` is only called from `run_compiler`. But rustfmt doesn't use `run_compiler`, so it needs to call `emit_stashed_diagnostics` itself to avoid an abort in `DiagCtxtInner::drop` when stashed diagnostics occur. Fixes rust-lang#121450.
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this issue
Feb 23, 2024
Explicitly call `emit_stashed_diagnostics`. Commit 72b172b in rust-lang#121206 changed things so that `emit_stashed_diagnostics` is only called from `run_compiler`. But rustfmt doesn't use `run_compiler`, so it needs to call `emit_stashed_diagnostics` itself to avoid an abort in `DiagCtxtInner::drop` when stashed diagnostics occur. Fixes rust-lang#121450. r? `@oli-obk`
rust-timer
added a commit
to rust-lang-ci/rust
that referenced
this issue
Feb 23, 2024
Rollup merge of rust-lang#121487 - nnethercote:fix-121450, r=oli-obk Explicitly call `emit_stashed_diagnostics`. Commit 72b172b in rust-lang#121206 changed things so that `emit_stashed_diagnostics` is only called from `run_compiler`. But rustfmt doesn't use `run_compiler`, so it needs to call `emit_stashed_diagnostics` itself to avoid an abort in `DiagCtxtInner::drop` when stashed diagnostics occur. Fixes rust-lang#121450. r? `@oli-obk`
For the record: it was #121206 that caused this. |
calebcartwright
pushed a commit
to calebcartwright/rust
that referenced
this issue
Jun 22, 2024
Commit 72b172b in rust-lang#121206 changed things so that `emit_stashed_diagnostics` is only called from `run_compiler`. But rustfmt doesn't use `run_compiler`, so it needs to call `emit_stashed_diagnostics` itself to avoid an abort in `DiagCtxtInner::drop` when stashed diagnostics occur. Fixes rust-lang#121450.
# for free
to join this conversation on GitHub.
Already have an account?
# to comment
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
A-rustfmt
Area: Rustfmt
C-bug
Category: This is a bug.
I-ICE
Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Code
#![u=||{static d=||1;}]
Meta
rustc --version --verbose
:Error output
rustfmt --check ./90873.rs --edition=2021
Backtrace
The text was updated successfully, but these errors were encountered: