Closed
Description
Code
#![feature(adt_const_params, lazy_type_alias)]
pub type Matrix = [usize; 1];
const EMPTY_MATRIX: Matrix = [0; 1];
pub struct Walk<const REMAINING: Matrix> {}
impl Walk<EMPTY_MATRIX> {
pub const fn new() -> Self {
Self {}
}
}
fn main() {
let _ = Walk::new();
}
Meta
rustc --version --verbose
:
rustc 1.73.0-nightly (474709a9a 2023-08-03)
binary: rustc
commit-hash: 474709a9a2a74a8bcf0055fadb335d0ca0d2d939
commit-date: 2023-08-03
host: x86_64-unknown-linux-gnu
release: 1.73.0-nightly
LLVM version: 16.0.5
Error output
<output>
Backtrace
warning: the feature `adt_const_params` is incomplete and may not be safe to use and/or cause compiler crashes
--> treereduce.out:1:12
|
1 | #![feature(adt_const_params, lazy_type_alias)]
| ^^^^^^^^^^^^^^^^
|
= note: see issue #95174 <https://github.com/rust-lang/rust/issues/95174> for more information
= note: `#[warn(incomplete_features)]` on by default
warning: the feature `lazy_type_alias` is incomplete and may not be safe to use and/or cause compiler crashes
--> treereduce.out:1:30
|
1 | #![feature(adt_const_params, lazy_type_alias)]
| ^^^^^^^^^^^^^^^
|
= note: see issue #112792 <https://github.com/rust-lang/rust/issues/112792> for more information
error: internal compiler error: no errors encountered even though `delay_span_bug` issued
error: internal compiler error: cannot relate consts of different types (a=Const { ty: Matrix, kind: ?0c }, b=Const { ty: [usize; 1], kind: Branch([Leaf(0x0000000000000000)]) })
|
= note: delayed at /rustc/474709a9a2a74a8bcf0055fadb335d0ca0d2d939/compiler/rustc_infer/src/infer/combine.rs:178:31
0: <rustc_errors::HandlerInner>::emit_diagnostic
1: <rustc_errors::Handler>::delay_span_bug::<rustc_span::span_encoding::Span, alloc::string::String>
2: <rustc_infer::infer::InferCtxt>::super_combine_consts::<rustc_infer::infer::nll_relate::TypeRelating<rustc_infer::infer::canonical::query_response::QueryTypeRelatingDelegate>>
3: <rustc_infer::infer::nll_relate::TypeRelating<rustc_infer::infer::canonical::query_response::QueryTypeRelatingDelegate> as rustc_middle::ty::relate::TypeRelation>::consts
4: <rustc_infer::infer::InferCtxt>::instantiate_nll_query_response_and_region_obligations::<()>
5: <rustc_middle::ty::ParamEnvAnd<rustc_middle::traits::query::type_op::AscribeUserType> as rustc_trait_selection::traits::query::type_op::TypeOp>::fully_perform
6: <rustc_borrowck::type_check::TypeChecker>::ascribe_user_type
7: rustc_borrowck::type_check::type_check
8: rustc_borrowck::nll::compute_regions
9: rustc_borrowck::do_mir_borrowck
10: rustc_borrowck::mir_borrowck
11: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::mir_borrowck::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 8]>>
12: <rustc_query_impl::query_impl::mir_borrowck::dynamic_query::{closure#2} as core::ops::function::FnOnce<(rustc_middle::ty::context::TyCtxt, rustc_span::def_id::LocalDefId)>>::call_once
13: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::VecCache<rustc_span::def_id::LocalDefId, rustc_middle::query::erase::Erased<[u8; 8]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
14: rustc_query_impl::query_impl::mir_borrowck::get_query_non_incr::__rust_end_short_backtrace
15: rustc_data_structures::sync::par_for_each_in::<&[rustc_span::def_id::LocalDefId], <rustc_middle::hir::map::Map>::par_body_owners<rustc_interface::passes::analysis::{closure#1}::{closure#0}>::{closure#0}>
16: <rustc_session::session::Session>::time::<(), rustc_interface::passes::analysis::{closure#1}>
17: rustc_interface::passes::analysis
18: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 1]>>
19: <rustc_query_impl::query_impl::analysis::dynamic_query::{closure#2} as core::ops::function::FnOnce<(rustc_middle::ty::context::TyCtxt, ())>>::call_once
20: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 1]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
21: rustc_query_impl::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
22: <rustc_middle::ty::context::GlobalCtxt>::enter::<rustc_driver_impl::run_compiler::{closure#1}::{closure#2}::{closure#4}, core::result::Result<(), rustc_span::ErrorGuaranteed>>
23: <rustc_interface::interface::Compiler>::enter::<rustc_driver_impl::run_compiler::{closure#1}::{closure#2}, core::result::Result<core::option::Option<rustc_interface::queries::Linker>, rustc_span::ErrorGuaranteed>>
24: std::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface::util::run_in_thread_pool_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>>
25: <<std::thread::Builder>::spawn_unchecked_<rustc_interface::util::run_in_thread_pool_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}
26: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
at /rustc/474709a9a2a74a8bcf0055fadb335d0ca0d2d939/library/alloc/src/boxed.rs:2007:9
27: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
at /rustc/474709a9a2a74a8bcf0055fadb335d0ca0d2d939/library/alloc/src/boxed.rs:2007:9
28: std::sys::unix::thread::Thread::new::thread_start
at /rustc/474709a9a2a74a8bcf0055fadb335d0ca0d2d939/library/std/src/sys/unix/thread.rs:108:17
29: <unknown>
30: <unknown>
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/im/rustc-ice-2023-08-04T10:13:31.528732612Z-1012286.txt` to your bug report
query stack during panic:
end of query stack
error: aborting due to 2 previous errors; 2 warnings emitted
Metadata
Metadata
Assignees
Labels
Category: This is a bug.`#![feature(adt_const_params)]``#![feature(lazy_type_alias)]`Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Status: This bug is tracked inside the repo by a `known-bug` test.Relevant to the compiler team, which will review and decide on the PR/issue.Fixed by the next-generation trait solver, `-Znext-solver`.This issue requires a nightly compiler in some way.