Skip to content

ICE with existential_type feature #60407

Closed
@phil-opp

Description

@phil-opp

Code (playground):

#![feature(existential_type)]

existential type Debuggable: core::fmt::Debug;

static mut TEST: Option<Debuggable> = None;

fn main() {
    unsafe { TEST = Some(foo()) }
}

fn foo() -> Debuggable {
    0u32
}

The core::fmt::Debug trait is just an example, the error occurs with every trait I tried.

Error:

error: internal compiler error: broken MIR in DefId(0/0:4 ~ playground[be34]::TEST[0]) (bb0[0]): equate_inputs_and_outputs: `std::option::Option<Debuggable>==std::option::Option<Debuggable>` failed with `NoSolution`
 --> src/main.rs:5:1
  |
5 | static mut TEST: Option<Debuggable> = None;
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

thread 'rustc' panicked at 'no errors encountered even though `delay_span_bug` issued', src/librustc_errors/lib.rs:355:17
Backtrace
stack backtrace:
   0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
             at src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:39
   1: std::sys_common::backtrace::_print
             at src/libstd/sys_common/backtrace.rs:71
   2: std::panicking::default_hook::{{closure}}
             at src/libstd/sys_common/backtrace.rs:59
             at src/libstd/panicking.rs:197
   3: std::panicking::default_hook
             at src/libstd/panicking.rs:211
   4: rustc::util::common::panic_hook
   5: std::panicking::rust_panic_with_hook
             at src/libstd/panicking.rs:478
   6: std::panicking::begin_panic
   7: <rustc_errors::Handler as core::ops::drop::Drop>::drop
   8: core::ptr::real_drop_in_place
   9: <alloc::rc::Rc<T> as core::ops::drop::Drop>::drop
  10: core::ptr::real_drop_in_place
  11: rustc_interface::interface::run_compiler_in_existing_thread_pool
  12: std::thread::local::LocalKey<T>::with
  13: scoped_tls::ScopedKey<T>::set
  14: syntax::with_globals
query stack during panic:
end of query stack

Possibly related to #54899, #53678, and #60371 (comment). Feel free to close this if this is a duplicate. I thought this might be useful for debugging because it (unlike the two other issues) does not use generators or futures.

cc @oli-obk (assigned to the two other issues)

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-impl-traitArea: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.F-type_alias_impl_trait`#[feature(type_alias_impl_trait)]`I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️P-mediumMedium priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.requires-nightlyThis issue requires a nightly compiler in some way.

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions