Skip to content
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

[Const generics] thread 'rustc' panicked at 'no errors encountered even though delay_span_bug issued' #63773

Closed
mcserv opened this issue Aug 21, 2019 · 1 comment · Fixed by #64858
Labels
A-const-generics Area: const generics (parameters and arguments) C-bug Category: This is a bug. F-const_generics `#![feature(const_generics)]` I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ requires-nightly This issue requires a nightly compiler in some way. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@mcserv
Copy link

mcserv commented Aug 21, 2019

The code simply does "not" compile, because compiler crashes.

I tried this code:

#![feature(const_generics)]

fn test<const A: &'static str, const B: &'static str>() {
    println!("{} {}", A, B);
}

fn main() {
    test::<"Hello", "World">();
}

Which is expected to compile without errors and execute the binary, which prints out "Hello World".

It's internal checks seem to fail while it produces seemingly working binary.

I say so because trying to run it again after the failure, it does work with no errors and it... prints "Hello World".

Meta

rustc --version --verbose:

rustc 1.39.0-nightly (bea0372a1 2019-08-20)
binary: rustc
commit-hash: bea0372a1a7a31b81f28cc4d9a83a2dc9a79d008
commit-date: 2019-08-20
host: x86_64-unknown-linux-gnu
release: 1.39.0-nightly
LLVM version: 9.0

Backtrace (RUST_BACKTRACE=full cargo run):

warning: the feature `const_generics` is incomplete and may cause the compiler to crash
 --> src/main.rs:1:12
  |
1 | #![feature(const_generics)]
  |            ^^^^^^^^^^^^^^
  |
  = note: `#[warn(incomplete_features)]` on by default

error: internal compiler error: broken MIR in DefId(0:15 ~ testbug[7665]::main[0]) (CanonicalUserTypeAnnotation { user_ty: Canonical { max_universe: U0, variables: [], value: TypeOf(DefId(0:12 ~ testbug[7665]::test[0]), UserSubsts { substs: [Const { ty: &'static str, val: Unevaluated(DefId(0:16 ~ testbug[7665]::main[0]::{{constant}}[0]), []) }, Const { ty: &'static str, val: Unevaluated(DefId(0:17 ~ testbug[7665]::main[0]::{{constant}}[1]), []) }], user_self_ty: None }) }, span: src/main.rs:8:5: 8:29, inferred_ty: fn() {test::<"Hello", "World">} }): bad user type AscribeUserType(fn() {test::<"Hello", "World">}, DefId(0:12 ~ testbug[7665]::test[0]) UserSubsts { substs: [Const { ty: &'static str, val: Unevaluated(DefId(0:16 ~ testbug[7665]::main[0]::{{constant}}[0]), []) }, Const { ty: &'static str, val: Unevaluated(DefId(0:17 ~ testbug[7665]::main[0]::{{constant}}[1]), []) }], user_self_ty: None }): NoSolution

error: internal compiler error: broken MIR in DefId(0:15 ~ testbug[7665]::main[0]) (const test::<"Hello", "World">): bad constant user type CanonicalUserTypeAnnotation { user_ty: Canonical { max_universe: U0, variables: [], value: TypeOf(DefId(0:12 ~ testbug[7665]::test[0]), UserSubsts { substs: [Const { ty: &'static str, val: Unevaluated(DefId(0:16 ~ testbug[7665]::main[0]::{{constant}}[0]), []) }, Const { ty: &'static str, val: Unevaluated(DefId(0:17 ~ testbug[7665]::main[0]::{{constant}}[1]), []) }], user_self_ty: None }) }, span: src/main.rs:8:5: 8:29, inferred_ty: fn() {test::<"Hello", "World">} } vs fn() {test::<"Hello", "World">}: NoSolution
 --> src/main.rs:8:5
  |
8 |     test::<"Hello", "World">();
  |     ^^^^^^^^^^^^^^^^^^^^^^^^

thread 'rustc' panicked at 'no errors encountered even though `delay_span_bug` issued', src/librustc_errors/lib.rs:360:17
stack backtrace:
   0:     0x7fafb0591742 - backtrace::backtrace::libunwind::trace::h1358d2edf0666fdd
                               at /cargo/registry/src/git.luolix.top-1ecc6299db9ec823/backtrace-0.3.35/src/backtrace/libunwind.rs:88
   1:     0x7fafb0591742 - backtrace::backtrace::trace_unsynchronized::hef042fe061eb4c23
                               at /cargo/registry/src/git.luolix.top-1ecc6299db9ec823/backtrace-0.3.35/src/backtrace/mod.rs:66
   2:     0x7fafb0591742 - std::sys_common::backtrace::_print::h9179b6bace739ad8
                               at src/libstd/sys_common/backtrace.rs:47
   3:     0x7fafb0591742 - std::sys_common::backtrace::print::hcf88edef7e09a883
                               at src/libstd/sys_common/backtrace.rs:36
   4:     0x7fafb0591742 - std::panicking::default_hook::{{closure}}::h8dc0d8684e782a7d
                               at src/libstd/panicking.rs:200
   5:     0x7fafb0591426 - std::panicking::default_hook::hf9f03712ee0993e3
                               at src/libstd/panicking.rs:214
   6:     0x7fafb24516a1 - rustc::util::common::panic_hook::h6a42bef1376a73bb
   7:     0x7fafb0591f7c - std::panicking::rust_panic_with_hook::h0ea1022fc447fb64
                               at src/libstd/panicking.rs:481
   8:     0x7fafb2837a25 - std::panicking::begin_panic::h4b303d0c24f0718d
   9:     0x7fafb2852015 - <rustc_errors::Handler as core::ops::drop::Drop>::drop::h412b37825c03be8d
  10:     0x7fafb0ac6a62 - core::ptr::real_drop_in_place::hd04278cb61ac8aea
  11:     0x7fafb0acae16 - <alloc::rc::Rc<T> as core::ops::drop::Drop>::drop::hd91d31ba89a5839f
  12:     0x7fafb0a7f09c - core::ptr::real_drop_in_place::h59844e5d47f4e573
  13:     0x7fafb0a7aae1 - rustc_interface::interface::run_compiler_in_existing_thread_pool::hdc75fb0fd8463a42
  14:     0x7fafb0ab34b2 - std::thread::local::LocalKey<T>::with::h8b398dfa59f49869
  15:     0x7fafb0abb45e - scoped_tls::ScopedKey<T>::set::hfc35056456681111
  16:     0x7fafb0aec9b2 - syntax::with_globals::habacbfaab82229eb
  17:     0x7fafb0a4b832 - std::sys_common::backtrace::__rust_begin_short_backtrace::h4741bd6aafe31c7e
  18:     0x7fafb05a283a - __rust_maybe_catch_panic
                               at src/libpanic_unwind/lib.rs:80
  19:     0x7fafb0a7ce89 - core::ops::function::FnOnce::call_once{{vtable.shim}}::hdf6a2a83fa760424
  20:     0x7fafb057540f - <alloc::boxed::Box<F> as core::ops::function::FnOnce<A>>::call_once::h0ccaf38361ac89de
                               at /rustc/bea0372a1a7a31b81f28cc4d9a83a2dc9a79d008/src/liballoc/boxed.rs:922
  21:     0x7fafb05a14c0 - <alloc::boxed::Box<F> as core::ops::function::FnOnce<A>>::call_once::h6bdddc9c647146b9
                               at /rustc/bea0372a1a7a31b81f28cc4d9a83a2dc9a79d008/src/liballoc/boxed.rs:922
  22:     0x7fafb05a14c0 - std::sys_common::thread::start_thread::hff9f2bb3b7a58e8c
                               at src/libstd/sys_common/thread.rs:13
  23:     0x7fafb05a14c0 - std::sys::unix::thread::Thread::new::thread_start::h88f38d807be79b1c
                               at src/libstd/sys/unix/thread.rs:79
  24:     0x7fafb03116db - start_thread
  25:     0x7fafafc2e88f - __clone
  26:                0x0 - <unknown>
query stack during panic:
end of query stack

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/blob/master/CONTRIBUTING.md#bug-reports

note: rustc 1.39.0-nightly (bea0372a1 2019-08-20) running on x86_64-unknown-linux-gnu

note: compiler flags: -C debuginfo=2 -C incremental --crate-type bin

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

error: Could not compile `testbug`.

As a note, I'm completely oblivious to what's wrong, I only searched if there's any similar issue that mentions 'no errors encountered even though delay_span_bug issued', and I didn't seem to find anything related, so sorry if this is duplicate. #60619 for example may point to identical issue as this, but I'll put this here just to be safe.

@jonas-schievink jonas-schievink added A-const-generics Area: const generics (parameters and arguments) C-bug Category: This is a bug. F-const_generics `#![feature(const_generics)]` I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ requires-nightly This issue requires a nightly compiler in some way. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Aug 21, 2019
@yodaldevoid
Copy link
Contributor

This is most likely related to #60813.

Centril added a commit to Centril/rust that referenced this issue Sep 29, 2019
Add support for relating slices in `super_relate_consts`

This allows passing strings as generic arguments.

Fixes rust-lang#63773
Fixes rust-lang#60813

r? @varkor
@bors bors closed this as completed in 4ada68e Sep 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-const-generics Area: const generics (parameters and arguments) C-bug Category: This is a bug. F-const_generics `#![feature(const_generics)]` I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ requires-nightly This issue requires a nightly compiler in some way. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants