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

ICE with existential_type feature #60407

Open
phil-opp opened this issue Apr 30, 2019 · 8 comments

Comments

Projects
None yet
5 participants
@phil-opp
Copy link
Contributor

commented Apr 30, 2019

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)

@Centril

This comment has been minimized.

Copy link
Member

commented Apr 30, 2019

Proposed prio: P-Low.

@oli-obk

This comment has been minimized.

Copy link
Contributor

commented Apr 30, 2019

heh. I don't think using existential types for anything but functions counts as a defining use. You can work around this ICE by placing foo and Debuggable into their own module: https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=f244de8aa281ac5960be54980e5ba03f

@DutchGhost

This comment has been minimized.

Copy link
Contributor

commented Apr 30, 2019

I guess you hit the same as this: #60371 (comment) .
At least the panic message is the same

@phil-opp

This comment has been minimized.

Copy link
Contributor Author

commented May 1, 2019

@oli-obk

You can work around this ICE by placing foo and Debuggable into their own module:

Interesting! I'm glad to see that my approach works in principle.

@phil-opp

This comment has been minimized.

Copy link
Contributor Author

commented May 1, 2019

@DutchGhost This seems quite similar indeed. I added the link to the issue description. Since I'm not sure if this is really the same I will keep this issue open for now.

@pnkfelix

This comment has been minimized.

Copy link
Member

commented May 2, 2019

triage: P-high due to ICE; removing nomination.

@pnkfelix

This comment has been minimized.

Copy link
Member

commented May 16, 2019

this should block stabilization of #34511 (and #44685, but latter is closed as dupe of former)

@pnkfelix

This comment has been minimized.

Copy link
Member

commented May 16, 2019

triage: Downgrading to P-medium based on this being an unstable feature. (Though arguably it is a feature that is so close to stabilization that we should re-update this to P-high in the near term.)

@pnkfelix pnkfelix added P-medium and removed P-high labels May 16, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.