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: glacier 65918.rs with -Zmir-opt-level=2 #75053

Closed
matthiaskrgr opened this issue Aug 2, 2020 · 1 comment · Fixed by #78133
Closed

ICE: glacier 65918.rs with -Zmir-opt-level=2 #75053

matthiaskrgr opened this issue Aug 2, 2020 · 1 comment · Fixed by #78133
Labels
A-mir-opt Area: MIR optimizations C-bug Category: This is a bug. E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. F-type_alias_impl_trait `#[feature(type_alias_impl_trait)]` glacier ICE tracked in rust-lang/glacier. 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

@matthiaskrgr
Copy link
Member

Code

Code is from glaciers 65918.rs, original ticket: #65918
The code still ICEs when checking with -Zmir-opt-level=2

#![feature(type_alias_impl_trait)]

use std::marker::PhantomData;

/* copied Index and TryFrom for convinience (and simplicity) */
trait MyIndex<T> {
    type O;
    fn my_index(self) -> Self::O;
}
trait MyFrom<T>: Sized {
    type Error;
    fn my_from(value: T) -> Result<Self, Self::Error>;
}

/* MCVE starts here */
trait F {}
impl F for () {}
type DummyT<T> = impl F;
fn _dummy_t<T>() -> DummyT<T> {}

struct Phantom1<T>(PhantomData<T>);
struct Phantom2<T>(PhantomData<T>);
struct Scope<T>(Phantom2<DummyT<T>>);

impl<T> Scope<T> {
    fn new() -> Self {
        unimplemented!()
    }
}

impl<T> MyFrom<Phantom2<T>> for Phantom1<T> {
    type Error = ();
    fn my_from(_: Phantom2<T>) -> Result<Self, Self::Error> {
        unimplemented!()
    }
}

impl<T: MyFrom<Phantom2<DummyT<U>>>, U> MyIndex<Phantom1<T>> for Scope<U> {
    type O = T;
    fn my_index(self) -> Self::O {
        MyFrom::my_from(self.0).ok().unwrap()
    }
}

fn main() {
    let _pos: Phantom1<DummyT<()>> = Scope::new().my_index();
}

Meta

repo is @ 12799ad

Error output

error: internal compiler error: Encountered error `Unimplemented` selecting `Binder(<T as MyFrom<Phantom2<impl F>>>)` during codegen
  |
  = note: delayed at /home/matthias/vcs/github/rust/src/librustc_session/session.rs:436:27

thread 'rustc' panicked at 'no errors encountered even though `delay_span_bug` issued', src/librustc_errors/lib.rs:366:17
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

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/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.47.0-dev running on x86_64-unknown-linux-gnu

note: compiler flags: -Z mir-opt-level=2

Backtrace

error: internal compiler error: Encountered error `Unimplemented` selecting `Binder(<T as MyFrom<Phantom2<impl F>>>)` during codegen
  |
  = note: delayed at /home/matthias/vcs/github/rust/src/librustc_session/session.rs:436:27

thread 'rustc' panicked at 'no errors encountered even though `delay_span_bug` issued', src/librustc_errors/lib.rs:366:17
stack backtrace:
   0:     0x7f0523b945a0 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::he42d29a748bbbd1e
   1:     0x7f0523c32a1c - core::fmt::write::hc3de054a6627b208
   2:     0x7f0523bb3753 - std::io::Write::write_fmt::h0f31a08a1acea6c9
   3:     0x7f0523bad080 - std::panicking::default_hook::{{closure}}::h500bdbd0f32aff44
   4:     0x7f0523baccbd - std::panicking::default_hook::h0dc2e03bf7be0812
   5:     0x7f0524c9be69 - rustc_driver::report_ice::h39a24bccd856358c
   6:     0x7f0523bad706 - std::panicking::rust_panic_with_hook::h8248fec3d52a4e49
   7:     0x7f052760554e - std::panicking::begin_panic::h6ec4b207f043b463
   8:     0x7f05275d273e - <rustc_errors::HandlerInner as core::ops::drop::Drop>::drop::h8580a5b14d9a09b5
   9:     0x7f0524b16046 - core::ptr::drop_in_place::h8e2a841ebc57267b
  10:     0x7f0524b1a700 - core::ptr::drop_in_place::hb3d9f649584de58e
  11:     0x7f0524b21e9d - core::ptr::drop_in_place::hf58666ccabfba218
  12:     0x7f0524aea720 - rustc_interface::interface::create_compiler_and_run::ha17d896c1829f0ee
  13:     0x7f0524c5c0de - scoped_tls::ScopedKey<T>::set::he92bf0fa18655a94
  14:     0x7f0524b0315c - std::sys_common::backtrace::__rust_begin_short_backtrace::h04546cabc08d32c7
  15:     0x7f0524c6773e - core::ops::function::FnOnce::call_once{{vtable.shim}}::h9dd17cde02219cce
  16:     0x7f0523baec38 - std::sys::unix::thread::Thread::new::thread_start::h66120da06ca148b6
  17:     0x7f05209af422 - start_thread
  18:     0x7f05239b2bf3 - __clone
  19:                0x0 - <unknown>

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/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.47.0-dev running on x86_64-unknown-linux-gnu

note: compiler flags: -Z mir-opt-level=2

query stack during panic:
end of query stack

@matthiaskrgr matthiaskrgr added C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Aug 2, 2020
@jonas-schievink jonas-schievink added F-type_alias_impl_trait `#[feature(type_alias_impl_trait)]` A-mir-opt Area: MIR optimizations requires-nightly This issue requires a nightly compiler in some way. labels Aug 2, 2020
@rust-lang-glacier-bot rust-lang-glacier-bot added the glacier ICE tracked in rust-lang/glacier. label Aug 3, 2020
@JohnTitor
Copy link
Member

Triage: It's now compiled fine with the latest nightly, perhaps it's fixed by #77306.

@JohnTitor JohnTitor added the E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. label Oct 19, 2020
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this issue Oct 20, 2020
Add some MIR-related regression tests

Closes rust-lang#68841
Closes rust-lang#75053
Closes rust-lang#76375
Closes rust-lang#77911

I think they're fixed by rust-lang#77306.
@bors bors closed this as completed in a8a424f Oct 20, 2020
@oli-obk oli-obk moved this from Todo to Done in type alias impl trait stabilization Sep 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-mir-opt Area: MIR optimizations C-bug Category: This is a bug. E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. F-type_alias_impl_trait `#[feature(type_alias_impl_trait)]` glacier ICE tracked in rust-lang/glacier. 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.
Development

Successfully merging a pull request may close this issue.

4 participants