Skip to content

rustc 1.32.0-nightly "no errors encountered even though delay_span_bug issued" #56520

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
mqudsi opened this issue Dec 4, 2018 · 8 comments
Closed
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@mqudsi
Copy link
Contributor

mqudsi commented Dec 4, 2018

I experienced the following trying to compile a crate with rustc 1.32.0-nightly (0c999ed 2018-12-03).

I put up a copy of the code in the state that caused this at neosmart/securestore-rs@rustc_crash.

thread 'rustc' panicked at 'index out of bounds: the len is 1 but the index is 1', /rustc/0c999ed132d67bf2520643e9bd619972cf3888ba/src/libcore/slice/mod.rs:2463:10
note: Run with `RUST_BACKTRACE=1` for a backtrace.
error: internal compiler error: cat_expr Errd
   --> securestore/src/lib.rs:76:87
    |
76  |       fn extract_keys(&self, iv: &Option<[u8; shared::IV_SIZE]>) -> Result<Keys, Error> {
    |  _______________________________________________________________________________________^
77  | |         let mut encryption_key = [0u8; shared::KEY_LENGTH];
78  | |         let mut hmac_key = [0u8; shared::KEY_LENGTH];
79  | |
...   |
117 | |         })
118 | |     }
    | |_____^

error: internal compiler error: cat_expr Errd
  --> securestore/src/lib.rs:80:15
   |
80 |         match &Self {
   |               ^^^^^

error: internal compiler error: cat_expr Errd
  --> securestore/src/lib.rs:80:16
   |
80 |         match &Self {
   |                ^^^^

error: internal compiler error: QualifyAndPromoteConstants: Mir had errors
   --> securestore/src/lib.rs:76:5
    |
76  | /     fn extract_keys(&self, iv: &Option<[u8; shared::IV_SIZE]>) -> Result<Keys, Error> {
77  | |         let mut encryption_key = [0u8; shared::KEY_LENGTH];
78  | |         let mut hmac_key = [0u8; shared::KEY_LENGTH];
79  | |
...   |
117 | |         })
118 | |     }
    | |_____^

error: internal compiler error: broken MIR in DefId(0/0:54 ~ securestore[d33c]::{{impl}}[1]::extract_keys[0]) ("return type"): bad type [type error]
   --> securestore/src/lib.rs:76:5
    |
76  | /     fn extract_keys(&self, iv: &Option<[u8; shared::IV_SIZE]>) -> Result<Keys, Error> {
77  | |         let mut encryption_key = [0u8; shared::KEY_LENGTH];
78  | |         let mut hmac_key = [0u8; shared::KEY_LENGTH];
79  | |
...   |
117 | |         })
118 | |     }
    | |_____^

error: internal compiler error: broken MIR in DefId(0/0:54 ~ securestore[d33c]::{{impl}}[1]::extract_keys[0]) (LocalDecl { mutability: Mut, is_user_variable: None, internal: false, is_block_tail: None, ty: [type error], user_ty: UserTypeProjections { contents: [] }, name: None, source_info: SourceInfo { span: securestore/src/lib.rs:76:5: 118:6, scope: scope[0] }, visibility_scope: scope[0] }): bad type [type error]
   --> securestore/src/lib.rs:76:5
    |
76  | /     fn extract_keys(&self, iv: &Option<[u8; shared::IV_SIZE]>) -> Result<Keys, Error> {
77  | |         let mut encryption_key = [0u8; shared::KEY_LENGTH];
78  | |         let mut hmac_key = [0u8; shared::KEY_LENGTH];
79  | |
...   |
117 | |         })
118 | |     }
    | |_____^

thread 'rustc' panicked at 'no errors encountered even though `delay_span_bug` issued', src/librustc_errors/lib.rs:334:17
stack backtrace:
   0:     0x7fe8be6d5c63 - std::sys::unix::backtrace::tracing::imp::unwind_backtrace::h8c27c4880bde890a
                               at src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
   1:     0x7fe8be6cd378 - std::sys_common::backtrace::_print::h94ad143e1a1f23ce
                               at src/libstd/sys_common/backtrace.rs:71
   2:     0x7fe8be6d26d2 - std::panicking::default_hook::{{closure}}::he4263dcd9a70a0a9
                               at src/libstd/sys_common/backtrace.rs:59
                               at src/libstd/panicking.rs:211
   3:     0x7fe8be6d243d - std::panicking::default_hook::he81ae3ee90693fac
                               at src/libstd/panicking.rs:227
   4:     0x7fe8baea7cd3 - rustc::util::common::panic_hook::h6ff7d65005b5c4d4
   5:     0x7fe8be6d2eb9 - std::panicking::rust_panic_with_hook::h0031c4eeabc83ca7
                               at src/libstd/panicking.rs:495
   6:     0x7fe8b9aee744 - std::panicking::begin_panic::hf7a210e797c2ef35
   7:     0x7fe8b9b00cb4 - <rustc_errors::Handler as core::ops::drop::Drop>::drop::h80f0d43cd8b57bf2
   8:     0x7fe8beab4711 - core::ptr::real_drop_in_place::ha1ba247982bc728d
   9:     0x7fe8beabac34 - rustc_driver::run_compiler_with_pool::h6807732b01150746
  10:     0x7fe8be9f5aa5 - <scoped_tls::ScopedKey<T>>::set::hde11c7bf316bfff6
  11:     0x7fe8beab91ea - rustc_driver::run_compiler::h2dda64ccf7980290
  12:     0x7fe8bea136de - rustc_driver::monitor::{{closure}}::h54c6ce747624f597
  13:     0x7fe8be6ef2e9 - __rust_maybe_catch_panic
                               at src/libpanic_unwind/lib.rs:102
  14:     0x7fe8bea04070 - <F as alloc::boxed::FnBox<A>>::call_box::h1b30e7f5bf58f422
  15:     0x7fe8be6e280d - std::sys::unix::thread::Thread::new::thread_start::h9ba17bb7e4aabdcb
                               at /rustc/0c999ed132d67bf2520643e9bd619972cf3888ba/src/liballoc/boxed.rs:683
                               at src/libstd/sys_common/thread.rs:24
                               at src/libstd/sys/unix/thread.rs:90
  16:     0x7fe8b8ad76da - start_thread
  17:     0x7fe8be39188e - __clone
  18:                0x0 - <unknown>
thread panicked while panicking. aborting.
error: Could not compile `securestore`.

Caused by:
  process didn't exit successfully: `rustc --edition=2018 --crate-name securestore securestore/src/lib.rs --color always --crate-type lib --emit=dep-info,link -C debuginfo=2 -C metadata=0749cce87946a744 -C extra-filename=-0749cce87946a744 --out-dir /mnt/d/GIT/securestore-rs/target/debug/deps -C incremental=/mnt/d/GIT/securestore-rs/target/debug/incremental -L dependency=/mnt/d/GIT/securestore-rs/target/debug/deps --extern openssl=/mnt/d/GIT/securestore-rs/target/debug/deps/libopenssl-2e68a25d4040a661.rlib --extern serde=/mnt/d/GIT/securestore-rs/target/debug/deps/libserde-40d2f6e887424bea.rlib --extern serde_derive=/mnt/d/GIT/securestore-rs/target/debug/deps/libserde_derive-f6d311be5ca0118f.so --extern serde_json=/mnt/d/GIT/securestore-rs/target/debug/deps/libserde_json-e41670aa8ec886a9.rlib -C target-cpu=native -C target-feature=+avx2` (signal: 4, SIGILL: illegal instruction)
@mqudsi mqudsi changed the title rustc 1.32.0-nightly index out of bounds rustc 1.32.0-nightly "no errors encountered even though delay_span_bug issued" Dec 4, 2018
@mqudsi
Copy link
Contributor Author

mqudsi commented Dec 4, 2018

Distilling extract_keys to the following reveals the problem:

    fn extract_keys(&self, iv: &Option<[u8; shared::IV_SIZE]>) -> Result<Keys, Error> {
        let mut encryption_key = [0u8; shared::KEY_LENGTH];
        let mut hmac_key = [0u8; shared::KEY_LENGTH];

        match &Self {
            KeySource::Generate => {
            },
            KeySource::File(path) => {
            },
            KeySource::Password(password) => {
            }
        };

        Ok(Keys {
            encryption: encryption_key,
            hmac: hmac_key,
        })
    }

The error in the code is using match &Self instead of match &self. Correcting that makes the crash disappear.

@Centril Centril added the I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ label Dec 5, 2018
@Centril
Copy link
Contributor

Centril commented Dec 5, 2018

@mqudsi is this a regression from stable or beta to nightly?

@dlrobertson
Copy link
Contributor

I'm able to reproduce this with the following

enum Test { }

impl Test {
    fn ice(&self) {
        match &Self {
            _ => { println!("ICE"); }
        }
    }
}

@Centril
Copy link
Contributor

Centril commented Dec 5, 2018

In that case it seems like a
Duplicate of #56199.

@dlrobertson
Copy link
Contributor

It would indeed appear so

@mqudsi
Copy link
Contributor Author

mqudsi commented Dec 7, 2018

Thanks.

@mqudsi mqudsi closed this as completed Dec 7, 2018
@folex
Copy link
Contributor

folex commented Feb 4, 2021

Happened to me on 1.51.0-nightly

error: internal compiler error: failed to process buffered lint here
  --> /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/fluence-fork-libp2p-secio-0.26.0/src/codec/len_prefix.rs:73:25
   |
73 |                         log::error!("data length {} exceeds allowed maximum {}", data.len(), max_len)
   |                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: delayed at /rustc/04caa632dd10c2bf64b69524c7f9c4c30a436877/compiler/rustc_lint/src/early.rs:384:18
   = note: this error: internal compiler error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

thread 'rustc' panicked at 'no errors encountered even though `delay_span_bug` issued', compiler/rustc_errors/src/lib.rs:974: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.51.0-nightly (04caa632d 2021-01-30) running on x86_64-unknown-linux-gnu

note: compiler flags: -C embed-bitcode=no -C debuginfo=2 --crate-type lib

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
end of query stack
error: could not compile `fluence-fork-libp2p-secio`

@mqudsi
Copy link
Contributor Author

mqudsi commented Feb 6, 2021

@folex do you have a repro? I'm guessing it's a different cause.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

No branches or pull requests

4 participants