Skip to content

ICE: panicked at 'no errors encountered even though delay_span_bug issued', compiler/rustc_errors/src/lib.rs:958:13 #78652

Closed
@chengniansun

Description

@chengniansun

Code

#![unstable(feature = "humans", issue = "none")]
#![feature(staged_api)]
struct Foo;
impl Foo {
    #[stable(feature = "rust1", since = "1.0.0")]
    const fn gated() -> u32 {
        42
    }
}

Meta

rustc --version --verbose:

rustc 1.49.0-nightly (4f7612ac1 2020-10-31)
binary: rustc
commit-hash: 4f7612ac1499258025077f1fd05d2f429f9accfb
commit-date: 2020-10-31
host: x86_64-unknown-linux-gnu
release: 1.49.0-nightly

Error output

warning: struct is never constructed: `Foo`
 --> reduced_mutant.rs:3:8
  |
3 | struct Foo;
  |        ^^^
  |
  = note: `#[warn(dead_code)]` on by default

warning: associated function is never used: `gated`
 --> reduced_mutant.rs:6:14
  |
6 |     const fn gated() -> u32 {
  |              ^^^^^

warning: 2 warnings emitted

error: internal compiler error: stable const functions must have either `rustc_const_stable` or `rustc_const_unstable` attribute
 --> reduced_mutant.rs:6:5
  |
6 |     const fn gated() -> u32 {
  |     ^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: delayed at compiler/rustc_mir/src/const_eval/fn_queries.rs:53:34

thread 'rustc' panicked at 'no errors encountered even though `delay_span_bug` issued', compiler/rustc_errors/src/lib.rs:958:13
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.49.0-nightly (4f7612ac1 2020-10-31) running on x86_64-unknown-linux-gnu

note: compiler flags: --crate-type staticlib

query stack during panic:
end of query stack
Backtrace

thread 'rustc' panicked at 'no errors encountered even though `delay_span_bug` issued', compiler/rustc_errors/src/lib.rs:958:13
stack backtrace:
   0: rust_begin_unwind
             at /rustc/4f7612ac1499258025077f1fd05d2f429f9accfb/library/std/src/panicking.rs:495:5
   1: std::panicking::begin_panic_fmt
             at /rustc/4f7612ac1499258025077f1fd05d2f429f9accfb/library/std/src/panicking.rs:437:5
   2: rustc_errors::HandlerInner::flush_delayed
   3: <rustc_errors::HandlerInner as core::ops::drop::Drop>::drop
   4: core::ptr::drop_in_place
   5: <alloc::rc::Rc<T> as core::ops::drop::Drop>::drop
   6: core::ptr::drop_in_place
   7: rustc_span::with_source_map
   8: scoped_tls::ScopedKey<T>::set

NOTE: The bug is found by our work-in-progress compiler testing tool Kira, and the test program is reduced/minimized by Perses

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-const-evalArea: Constant evaluation, covers all const contexts (static, const fn, ...)A-stabilityArea: `#[stable]`, `#[unstable]` etc.C-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.glacierICE tracked in rust-lang/glacier.requires-nightlyThis issue requires a nightly compiler in some way.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions