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

Closed
phil-opp opened this issue Apr 30, 2019 · 9 comments · Fixed by #63096
Closed

ICE with existential_type feature #60407

phil-opp opened this issue Apr 30, 2019 · 9 comments · Fixed by #63096
Labels
A-impl-trait Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch. F-type_alias_impl_trait `#[feature(type_alias_impl_trait)]` I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-medium Medium priority 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

@phil-opp
Copy link
Contributor

phil-opp 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 Centril added I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ A-impl-trait Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. I-nominated labels Apr 30, 2019
@Centril
Copy link
Contributor

Centril commented Apr 30, 2019

Proposed prio: P-Low.

@oli-obk
Copy link
Contributor

oli-obk 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
Copy link
Contributor

DutchGhost commented Apr 30, 2019

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

@phil-opp
Copy link
Contributor Author

phil-opp 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
Copy link
Contributor Author

phil-opp 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
Copy link
Member

pnkfelix commented May 2, 2019

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

@pnkfelix
Copy link
Member

pnkfelix commented May 16, 2019

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

@pnkfelix
Copy link
Member

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 Medium priority and removed P-high High priority labels May 16, 2019
@Centril Centril added F-type_alias_impl_trait `#[feature(type_alias_impl_trait)]` requires-nightly This issue requires a nightly compiler in some way. labels Jul 28, 2019
@Aaron1011
Copy link
Member

This no longer ICEs on the latest nightly.

Centril added a commit to Centril/rust that referenced this issue Jul 29, 2019
Centril added a commit to Centril/rust that referenced this issue Jul 29, 2019
… r=varkor

Add tests for some `existential_type` ICEs

Fix rust-lang#53678
Fix rust-lang#60407
Fix rust-lang#60564

rust-lang#54899 will need some minimization before it can be added.

r? @varkor
Centril added a commit to Centril/rust that referenced this issue Jul 30, 2019
… r=varkor

Add tests for some `existential_type` ICEs

Fix rust-lang#53678
Fix rust-lang#60407
Fix rust-lang#60564

rust-lang#54899 will need some minimization before it can be added.

r? @varkor
Centril added a commit to Centril/rust that referenced this issue Jul 30, 2019
… r=varkor

Add tests for some `existential_type` ICEs

Fix rust-lang#53678
Fix rust-lang#60407
Fix rust-lang#60564

rust-lang#54899 will need some minimization before it can be added.

r? @varkor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-impl-trait Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch. F-type_alias_impl_trait `#[feature(type_alias_impl_trait)]` I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-medium Medium priority 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.
Development

Successfully merging a pull request may close this issue.

6 participants