Closed
Description
opened on Oct 2, 2023
Code
rustc src/lib.rs -Copt-level=2
#![feature(type_alias_impl_trait)]
#![crate_type = "lib"]
pub trait Tr {
fn get(&self) -> u32;
}
impl Tr for (u32,) {
#[inline]
fn get(&self) -> u32 { self.0 }
}
pub fn tr1() -> impl Tr {
(32,)
}
pub fn tr2() -> impl Tr {
struct Inner {
x: X,
}
type X = impl Tr;
impl Tr for Inner {
fn get(&self) -> u32 {
self.x.get()
}
}
Inner {
x: tr1(),
}
}
Meta
rustc --version --verbose
:
rustc 1.75.0-nightly (e0d7ed1f4 2023-10-01)
binary: rustc
commit-hash: e0d7ed1f453fb54578cc96dfea859b0e7be15016
commit-date: 2023-10-01
host: x86_64-unknown-linux-gnu
release: 1.75.0-nightly
LLVM version: 17.0.2
Error output
error: internal compiler error: no errors encountered even though `delay_span_bug` issued
error: internal compiler error: broken MIR in Item(DefId(0:13 ~ lib[4350]::tr2::{impl#0}::get)) (after phase change to runtime-optimized) at bb0[1]:
Alias(Opaque, AliasTy { args: [], def_id: DefId(0:18 ~ lib[4350]::tr2::X::{opaque#0}) }) does not have fields
--> src/lib.rs:10:28
|
10 | fn get(&self) -> u32 { self.0 }
| ^^^^^^
|
Backtrace
error: internal compiler error: no errors encountered even though `delay_span_bug` issued
error: internal compiler error: broken MIR in Item(DefId(0:13 ~ lib[4350]::tr2::{impl#0}::get)) (after phase change to runtime-optimized) at bb0[1]:
Alias(Opaque, AliasTy { args: [], def_id: DefId(0:18 ~ lib[4350]::tr2::X::{opaque#0}) }) does not have fields
--> src/lib.rs:10:28
|
10 | fn get(&self) -> u32 { self.0 }
| ^^^^^^
|
note: delayed at compiler/rustc_const_eval/src/transform/validate.rs:94:25
0: <rustc_errors::HandlerInner>::emit_diagnostic
1: <rustc_errors::Handler>::delay_span_bug::<rustc_span::span_encoding::Span, alloc::string::String>
2: <rustc_const_eval::transform::validate::CfgChecker>::fail::<alloc::string::String>
3: <rustc_const_eval::transform::validate::Validator as rustc_middle::mir::MirPass>::run_pass
4: rustc_mir_transform::pass_manager::run_passes_inner
5: rustc_mir_transform::optimized_mir
6: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::optimized_mir::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 8]>>
7: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::DefaultCache<rustc_span::def_id::DefId, rustc_middle::query::erase::Erased<[u8; 8]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
8: rustc_query_impl::query_impl::optimized_mir::get_query_non_incr::__rust_end_short_backtrace
9: <rustc_middle::ty::context::TyCtxt>::instance_mir
10: rustc_monomorphize::collector::collect_items_rec::{closure#0}
11: rustc_monomorphize::collector::collect_items_rec
12: rustc_monomorphize::partitioning::collect_and_partition_mono_items
13: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::collect_and_partition_mono_items::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 24]>>
14: <rustc_query_impl::query_impl::collect_and_partition_mono_items::dynamic_query::{closure#2} as core::ops::function::FnOnce<(rustc_middle::ty::context::TyCtxt, ())>>::call_once
15: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 24]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
16: rustc_query_impl::query_impl::collect_and_partition_mono_items::get_query_non_incr::__rust_end_short_backtrace
17: <rustc_codegen_llvm::LlvmCodegenBackend as rustc_codegen_ssa::traits::backend::CodegenBackend>::codegen_crate
18: rustc_interface::passes::start_codegen
19: <rustc_interface::queries::Queries>::ongoing_codegen
20: std::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface::util::run_in_thread_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}, core::result::Resu
lt<(), rustc_span::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>
21: <<std::thread::Builder>::spawn_unchecked_<rustc_interface::util::run_in_thread_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_span
::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#1} as core::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
22: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
at /rustc/e0d7ed1f453fb54578cc96dfea859b0e7be15016/library/alloc/src/boxed.rs:2007:9
23: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
at /rustc/e0d7ed1f453fb54578cc96dfea859b0e7be15016/library/alloc/src/boxed.rs:2007:9
24: std::sys::unix::thread::Thread::new::thread_start
at /rustc/e0d7ed1f453fb54578cc96dfea859b0e7be15016/library/std/src/sys/unix/thread.rs:108:17
25: start_thread
26: __clone3
--> src/lib.rs:10:28
|
10 | fn get(&self) -> u32 { self.0 }
| ^^^^^^
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: please attach the file at `/tmp/ice/rustc-ice-2023-10-02T07:44:08.697812242Z-3453279.txt` to your bug report
note: compiler flags: -C opt-level=2
query stack during panic:
end of query stack
rustc-ice-*.txt
delayed span bug: broken MIR in Item(DefId(0:13 ~ lib[4350]::tr2::{impl#0}::get)) (after phase change to runtime-optimized) at bb0[1]:
Alias(Opaque, AliasTy { args: [], def_id: DefId(0:18 ~ lib[4350]::tr2::X::{opaque#0}) }) does not have fields
0: <rustc_errors::HandlerInner>::emit_diagnostic
1: <rustc_errors::Handler>::delay_span_bug::<rustc_span::span_encoding::Span, alloc::string::String>
2: <rustc_const_eval::transform::validate::CfgChecker>::fail::<alloc::string::String>
3: <rustc_const_eval::transform::validate::Validator as rustc_middle::mir::MirPass>::run_pass
4: rustc_mir_transform::pass_manager::run_passes_inner
5: rustc_mir_transform::optimized_mir
6: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::optimized_mir::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 8]>>
7: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::DefaultCache<rustc_span::def_id::DefId, rustc_middle::query::erase::Erased<[u8; 8]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
8: rustc_query_impl::query_impl::optimized_mir::get_query_non_incr::__rust_end_short_backtrace
9: <rustc_middle::ty::context::TyCtxt>::instance_mir
10: rustc_monomorphize::collector::collect_items_rec::{closure#0}
11: rustc_monomorphize::collector::collect_items_rec
12: rustc_monomorphize::partitioning::collect_and_partition_mono_items
13: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::collect_and_partition_mono_items::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 24]>>
14: <rustc_query_impl::query_impl::collect_and_partition_mono_items::dynamic_query::{closure#2} as core::ops::function::FnOnce<(rustc_middle::ty::context::TyCtxt, ())>>::call_once
15: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 24]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
16: rustc_query_impl::query_impl::collect_and_partition_mono_items::get_query_non_incr::__rust_end_short_backtrace
17: <rustc_codegen_llvm::LlvmCodegenBackend as rustc_codegen_ssa::traits::backend::CodegenBackend>::codegen_crate
18: rustc_interface::passes::start_codegen
19: <rustc_interface::queries::Queries>::ongoing_codegen
20: std::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface::util::run_in_thread_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(),
rustc_span::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>
21: <<std::thread::Builder>::spawn_unchecked_<rustc_interface::util::run_in_thread_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_span::Erro
rGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#1} as core::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
22: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
at /rustc/e0d7ed1f453fb54578cc96dfea859b0e7be15016/library/alloc/src/boxed.rs:2007:9
23: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
at /rustc/e0d7ed1f453fb54578cc96dfea859b0e7be15016/library/alloc/src/boxed.rs:2007:9
24: std::sys::unix::thread::Thread::new::thread_start
at /rustc/e0d7ed1f453fb54578cc96dfea859b0e7be15016/library/std/src/sys/unix/thread.rs:108:17
25: start_thread
26: __clone3
rustc version: 1.75.0-nightly (e0d7ed1f4 2023-10-01)
platform: x86_64-unknown-linux-gnu
Activity