rustc_codegen_cranelift icon indicating copy to clipboard operation
rustc_codegen_cranelift copied to clipboard

ICE: delay_span_bug type alias impl trait

Open matthiaskrgr opened this issue 2 years ago • 0 comments

This is kind of a weird one, it looks like it might be a rustc problem but I was unable to reproduce it with standalone rustc :|

code from ./src/test/ui/type-alias-impl-trait/issue-72793.rs

// check-pass
// compile-flags: -Zmir-opt-level=3

#![feature(type_alias_impl_trait)]

trait T { type Item; }

type Alias<'a> = impl T<Item = &'a ()>;

struct S;
impl<'a> T for &'a S {
    type Item = &'a ();
}

fn filter_positive<'a>() -> Alias<'a> {
    &S
}

fn with_positive(fun: impl Fn(Alias<'_>)) {
    fun(filter_positive());
}

fn main() {
    with_positive(|_| ());
}
error: internal compiler error: no errors encountered even though `delay_span_bug` issued

error: internal compiler error: VecMap([(OpaqueTypeKey { def_id: DefId(0:7 ~ issue_72793[97c3]::Alias::{opaque#0}), substs: ['_#0r] }, OpaqueTypeDecl { hidden_type: OpaqueHiddenType { span: no-location (#0), ty: &S }, origin: TyAlias })])
  |
  = note: delayed at compiler/rustc_infer/src/infer/opaque_types/table.rs:50:26

thread 'rustc' panicked at 'Box<dyn Any>', compiler/rustc_errors/src/lib.rs:1425:13
stack backtrace:
   0:     0x7f2facca1b20 - std::backtrace_rs::backtrace::libunwind::trace::h419808c895a1be3b
                               at /rustc/f2d93935ffba3ab9d7ccb5300771a2d29b4c8bf3/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   1:     0x7f2facca1b20 - std::backtrace_rs::backtrace::trace_unsynchronized::h4cd640051eb1546f
                               at /rustc/f2d93935ffba3ab9d7ccb5300771a2d29b4c8bf3/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f2facca1b20 - std::sys_common::backtrace::_print_fmt::h6a643b487717d871
                               at /rustc/f2d93935ffba3ab9d7ccb5300771a2d29b4c8bf3/library/std/src/sys_common/backtrace.rs:66:5
   3:     0x7f2facca1b20 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h84bab1c2a632e967
                               at /rustc/f2d93935ffba3ab9d7ccb5300771a2d29b4c8bf3/library/std/src/sys_common/backtrace.rs:45:22
   4:     0x7f2faccfa85c - core::fmt::write::h41252a77742ac576
                               at /rustc/f2d93935ffba3ab9d7ccb5300771a2d29b4c8bf3/library/core/src/fmt/mod.rs:1198:17
   5:     0x7f2facc933c5 - std::io::Write::write_fmt::h68f35cff36a534dd
                               at /rustc/f2d93935ffba3ab9d7ccb5300771a2d29b4c8bf3/library/std/src/io/mod.rs:1672:15
   6:     0x7f2facca4711 - std::sys_common::backtrace::_print::h82f0b1ac2501b6af
                               at /rustc/f2d93935ffba3ab9d7ccb5300771a2d29b4c8bf3/library/std/src/sys_common/backtrace.rs:48:5
   7:     0x7f2facca4711 - std::sys_common::backtrace::print::h3dc7f0e84685b9ba
                               at /rustc/f2d93935ffba3ab9d7ccb5300771a2d29b4c8bf3/library/std/src/sys_common/backtrace.rs:35:9
   8:     0x7f2facca4711 - std::panicking::default_hook::{{closure}}::h6ace3fe16ec6f7aa
                               at /rustc/f2d93935ffba3ab9d7ccb5300771a2d29b4c8bf3/library/std/src/panicking.rs:295:22
   9:     0x7f2facca43e3 - std::panicking::default_hook::h77c1c7afb621e87c
                               at /rustc/f2d93935ffba3ab9d7ccb5300771a2d29b4c8bf3/library/std/src/panicking.rs:314:9
  10:     0x7f2fad53f824 - rustc_driver[e83335c4a38137f8]::DEFAULT_HOOK::{closure#0}::{closure#0}
  11:     0x7f2facca4ee6 - std::panicking::rust_panic_with_hook::h4cc32db16e14054a
                               at /rustc/f2d93935ffba3ab9d7ccb5300771a2d29b4c8bf3/library/std/src/panicking.rs:702:17
  12:     0x7f2fae6d0cb1 - std[a38b499b13c80ab0]::panicking::begin_panic::<rustc_errors[cf96977925b9f0c]::ExplicitBug>::{closure#0}
  13:     0x7f2fae6d0976 - std[a38b499b13c80ab0]::sys_common::backtrace::__rust_end_short_backtrace::<std[a38b499b13c80ab0]::panicking::begin_panic<rustc_errors[cf96977925b9f0c]::ExplicitBug>::{closure#0}, !>
  14:     0x7f2fae6ca426 - std[a38b499b13c80ab0]::panicking::begin_panic::<rustc_errors[cf96977925b9f0c]::ExplicitBug>
  15:     0x7f2fae6cd656 - std[a38b499b13c80ab0]::panic::panic_any::<rustc_errors[cf96977925b9f0c]::ExplicitBug>
  16:     0x7f2faff3e129 - <rustc_errors[cf96977925b9f0c]::HandlerInner as core[303bee78761e0753]::ops::drop::Drop>::drop
  17:     0x7f2faf6a5ad8 - core[303bee78761e0753]::ptr::drop_in_place::<rustc_session[16e8265f3bee680e]::parse::ParseSess>
  18:     0x7f2faf6a81c3 - <alloc[aede580a0175a08c]::rc::Rc<rustc_session[16e8265f3bee680e]::session::Session> as core[303bee78761e0753]::ops::drop::Drop>::drop
  19:     0x7f2faf68cadd - core[303bee78761e0753]::ptr::drop_in_place::<rustc_interface[edbb2596f0660065]::interface::Compiler>
  20:     0x7f2faf68ac85 - rustc_span[550c183cd1c0caaa]::with_source_map::<core[303bee78761e0753]::result::Result<(), rustc_errors[cf96977925b9f0c]::ErrorGuaranteed>, rustc_interface[edbb2596f0660065]::interface::create_compiler_and_run<core[303bee78761e0753]::result::Result<(), rustc_errors[cf96977925b9f0c]::ErrorGuaranteed>, rustc_driver[e83335c4a38137f8]::run_compiler::{closure#1}>::{closure#1}>
  21:     0x7f2faf6a50f2 - rustc_interface[edbb2596f0660065]::interface::create_compiler_and_run::<core[303bee78761e0753]::result::Result<(), rustc_errors[cf96977925b9f0c]::ErrorGuaranteed>, rustc_driver[e83335c4a38137f8]::run_compiler::{closure#1}>
  22:     0x7f2faf68a2b2 - <scoped_tls[c1a1588d7c68db11]::ScopedKey<rustc_span[550c183cd1c0caaa]::SessionGlobals>>::set::<rustc_interface[edbb2596f0660065]::interface::run_compiler<core[303bee78761e0753]::result::Result<(), rustc_errors[cf96977925b9f0c]::ErrorGuaranteed>, rustc_driver[e83335c4a38137f8]::run_compiler::{closure#1}>::{closure#0}, core[303bee78761e0753]::result::Result<(), rustc_errors[cf96977925b9f0c]::ErrorGuaranteed>>
  23:     0x7f2faf68cfcf - std[a38b499b13c80ab0]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[edbb2596f0660065]::util::run_in_thread_pool_with_globals<rustc_interface[edbb2596f0660065]::interface::run_compiler<core[303bee78761e0753]::result::Result<(), rustc_errors[cf96977925b9f0c]::ErrorGuaranteed>, rustc_driver[e83335c4a38137f8]::run_compiler::{closure#1}>::{closure#0}, core[303bee78761e0753]::result::Result<(), rustc_errors[cf96977925b9f0c]::ErrorGuaranteed>>::{closure#0}, core[303bee78761e0753]::result::Result<(), rustc_errors[cf96977925b9f0c]::ErrorGuaranteed>>
  24:     0x7f2faf6a5539 - <<std[a38b499b13c80ab0]::thread::Builder>::spawn_unchecked_<rustc_interface[edbb2596f0660065]::util::run_in_thread_pool_with_globals<rustc_interface[edbb2596f0660065]::interface::run_compiler<core[303bee78761e0753]::result::Result<(), rustc_errors[cf96977925b9f0c]::ErrorGuaranteed>, rustc_driver[e83335c4a38137f8]::run_compiler::{closure#1}>::{closure#0}, core[303bee78761e0753]::result::Result<(), rustc_errors[cf96977925b9f0c]::ErrorGuaranteed>>::{closure#0}, core[303bee78761e0753]::result::Result<(), rustc_errors[cf96977925b9f0c]::ErrorGuaranteed>>::{closure#1} as core[303bee78761e0753]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  25:     0x7f2faccae843 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h6cafef397152c3f0
                               at /rustc/f2d93935ffba3ab9d7ccb5300771a2d29b4c8bf3/library/alloc/src/boxed.rs:1951:9
  26:     0x7f2faccae843 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h0308246411b63a3b
                               at /rustc/f2d93935ffba3ab9d7ccb5300771a2d29b4c8bf3/library/alloc/src/boxed.rs:1951:9
  27:     0x7f2faccae843 - std::sys::unix::thread::Thread::new::thread_start::hd2e6d604897dcfa7
                               at /rustc/f2d93935ffba3ab9d7ccb5300771a2d29b4c8bf3/library/std/src/sys/unix/thread.rs:108:17
  28:     0x7f2faca8054d - <unknown>
  29:     0x7f2facb05874 - clone
  30:                0x0 - <unknown>

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.64.0-nightly (f2d93935f 2022-07-02) running on x86_64-unknown-linux-gnu

note: compiler flags: -C panic=abort -Z panic-abort-tests -Z codegen-backend=/home/matthias/vcs/github/rustc_codegen_cranelift/build/lib/librustc_codegen_cranelift.so

query stack during panic:
end of query stack

matthiaskrgr avatar Jul 07 '22 20:07 matthiaskrgr