Closed
Description
Code
#![feature(generic_const_exprs)]
struct Foo<const A: [(); 0 + 0]>
where [(); 0 + 0]: Sized;
Note that it is required for both array lengths to be not a literal in order to trigger this bug.
Meta
Quite surprisingly, despite using #![feature]
, it works not only on nightly but on beta and stable as well. Although backtraces differ, the failed assertion is the same.
rustc --version --verbose
:
rustc 1.56.1 (59eed8a2a 2021-11-01)
binary: rustc
commit-hash: 59eed8a2aac0230a8b53e89d4e99d55912ba6b35
commit-date: 2021-11-01
host: x86_64-pc-windows-msvc
release: 1.56.1
LLVM version: 13.0.0
Error output
error[E0554]: `#![feature]` may not be used on the stable release channel
--> lib.rs:1:1
|
1 | #![feature(generic_const_exprs)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
warning: the feature `generic_const_exprs` is incomplete and may not be safe to use and/or cause compiler crashes
--> lib.rs:1:12
|
1 | #![feature(generic_const_exprs)]
| ^^^^^^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #76560 <https://github.com/rust-lang/rust/issues/76560> for more information
thread 'rustc' panicked at 'assertion failed: !arg.has_type_flags(!allowed_flags)', compiler\rustc_typeck\src\collect\type_of.rs:297:9
stack backtrace:
<snip, see below>
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.56.1 (59eed8a2a 2021-11-01) running on x86_64-pc-windows-msvc
query stack during panic:
#0 [default_anon_const_substs] computing the default generic arguments for `Foo::{constant#1}`
#1 [param_env] computing normalized predicates of `Foo`
#2 [check_item_well_formed] checking that `Foo` is well-formed
#3 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to previous error; 1 warning emitted
Setting RUST_BACKTRACE=1
revealed no stack frames at all so I used RUST_BACKTRACE=full
.
Backtrace
0: 0x7ffd4de87a9e - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h90fc78c6027cfe27
1: 0x7ffd4deb268a - core::fmt::write::h8afcb1031f89d60b
2: 0x7ffd4de7ae08 - <std::io::IoSliceMut as core::fmt::Debug>::fmt::hb4b34c43836aedaf
3: 0x7ffd4de8b586 - std::panicking::take_hook::h8b2fe3f8f4cf4b43
4: 0x7ffd4de8b074 - std::panicking::take_hook::h8b2fe3f8f4cf4b43
5: 0x86d770a525 - <serde_json::value::WriterFormatter as std::io::Write>::flush::hc1d196eaca04d7a8
6: 0x7ffd4de8be99 - std::panicking::rust_panic_with_hook::h844a8dc19bbe524e
7: 0x7ffd4de8b90f - rust_begin_unwind
8: 0x7ffd4de883e7 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h90fc78c6027cfe27
9: 0x7ffd4de8b899 - rust_begin_unwind
10: 0x7ffd4dee8d10 - core::panicking::panic_fmt::h27a79246687269a4
11: 0x7ffd4dee8c5c - core::panicking::panic::h4b6e61fc90377b73
12: 0x86d9fa5c7e - <rustc_typeck::coherence::unsafety::UnsafetyChecker as rustc_hir::itemlikevisit::ItemLikeVisitor>::visit_item::h682aa4275916ccf2
13: 0x86dab4d8cc - <fixedbitset::FixedBitSet as core::fmt::Debug>::fmt::hedf20157683d04ae
14: 0x86daee596d - <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::try_mark_green::h02f98d8f46101c14
15: 0x86db8241cf - <rustc_trait_selection::traits::on_unimplemented::OnUnimplementedDirective as core::fmt::Debug>::fmt::hdad6ed0876437135
16: 0x86db8c3ca2 - <rustc_trait_selection::opaque_types::GenerateMemberConstraints as core::fmt::Debug>::fmt::h6351a5ad34a7afd7
17: 0x86db8f1c43 - <rustc_infer::infer::lub::Lub as rustc_middle::ty::relate::TypeRelation>::tcx::hd8dcd1498c2c37da
18: 0x86db83ff39 - <rustc_trait_selection::traits::specialize::OverlapError as core::fmt::Debug>::fmt::h82cecc3e256aff77
19: 0x86db8f0927 - rustc_trait_selection::traits::project::AssocTypeNormalizer::new::hf5a40d1813a3e002
20: 0x86db8ee8cd - <rustc_trait_selection::traits::wf::Elaborate as core::fmt::Debug>::fmt::h98a2adc5ad82cba2
21: 0x86db88ad3d - rustc_trait_selection::traits::normalize_param_env_or_error::h6c082e5471b3c0d8
22: 0x86db7a1b51 - <unicode_normalization::stream_safe::Decomposition as core::fmt::Debug>::fmt::h4cb36b1bc76a44b4
23: 0x86db889f8b - rustc_trait_selection::traits::type_known_to_meet_bound_modulo_regions::h6d992d2ac142b395
24: 0x86db88a1c2 - rustc_trait_selection::traits::normalize_param_env_or_error::h6c082e5471b3c0d8
25: 0x86da083bd1 - rustc_ty_utils::provide::hb69364e707605161
26: 0x86dab833cc - <fixedbitset::FixedBitSet as core::fmt::Debug>::fmt::hedf20157683d04ae
27: 0x86daeed260 - <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::try_mark_green::h02f98d8f46101c14
28: 0x86da05f805 - rustc_typeck::check::intrinsic::check_platform_intrinsic_type::h1f8cb0a40e4e11fe
29: 0x86da05cece - rustc_typeck::check::intrinsic::check_platform_intrinsic_type::h1f8cb0a40e4e11fe
30: 0x86dab4ff32 - <fixedbitset::FixedBitSet as core::fmt::Debug>::fmt::hedf20157683d04ae
31: 0x86daeee981 - <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::try_mark_green::h02f98d8f46101c14
32: 0x86da066c9a - <rustc_typeck::check::wfcheck::CheckTypeWellFormedVisitor as rustc_hir::intravisit::Visitor>::visit_item::ha4fd906560a43a45
33: 0x86d9fcee58 - <rustc_typeck::check::writeback::Resolver as rustc_middle::ty::fold::TypeFolder>::fold_const::he13d4a92cbd78022
34: 0x86d9f89199 - <rustc_typeck::check::method::confirm::ConfirmResult as core::fmt::Debug>::fmt::h12133a562210cf53
35: 0x86d9eb3d01 - <rustc_typeck::check::PlaceOp as core::fmt::Debug>::fmt::h8616b96de76e95b0
36: 0x86d9e82ef1 - rustc_typeck::check_crate::h72808c5b688a43c3
37: 0x86d7849bd2 - rustc_interface::passes::analysis::h213d2025de663219
38: 0x86dab6cbd2 - <fixedbitset::FixedBitSet as core::fmt::Debug>::fmt::hedf20157683d04ae
39: 0x86daee5afc - <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::try_mark_green::h02f98d8f46101c14
40: 0x86d775f28d - regex_syntax::hir::Error::pattern::h26de5cae1e560f3c
41: 0x86d77297b5 - rustc_driver::pretty::print_after_hir_lowering::h8daab7168b9a121b
42: 0x86d77614c7 - regex_syntax::hir::Error::pattern::h26de5cae1e560f3c
43: 0x86d772dfc0 - <tracing_subscriber::util::TryInitError as core::fmt::Display>::fmt::h6e9774f2c0dd7eb3
44: 0x86d772a248 - rustc_driver::pretty::print_after_hir_lowering::h8daab7168b9a121b
45: 0x86d771e67d - <rustc_driver::Compilation as core::fmt::Debug>::fmt::ha388fa55e25fcec9
46: 0x7ffd4de9a1cc - std::sys::windows::thread::Thread::new::h5ab92c811b2297f5
47: 0x7ffd825213d2 - BaseThreadInitThunk
48: 0x7ffd832754f4 - RtlUserThreadStart
Metadata
Metadata
Assignees
Labels
Category: This is a bug.Call for participation: An issue has been fixed and does not reproduce, but no test has been added.`#![feature(generic_const_exprs)]`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.