Closed
Description
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
Metadata
Metadata
Assignees
Labels
Area: MIR optimizationsCategory: This is a bug.Call for participation: An issue has been fixed and does not reproduce, but no test has been added.`#[feature(type_alias_impl_trait)]`Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Relevant to the compiler team, which will review and decide on the PR/issue.ICE tracked in rust-lang/glacier.This issue requires a nightly compiler in some way.
Type
Projects
Status
Done