Closed
Description
Code
#![feature(generic_const_exprs)]
struct S<const C:() = {}>() where S<{}>:;
Meta
rustc --version --verbose
:
rustc 1.59.0 (9d1b2106e 2022-02-23)
binary: rustc
commit-hash: 9d1b2106e23b1abd32fce1f17267604a5102f57a
commit-date: 2022-02-23
host: x86_64-unknown-linux-gnu
release: 1.59.0
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
error[E0601]: `main` function not found in crate `lib`
--> lib.rs:1:1
|
1 | / #![feature(generic_const_exprs)]
2 | |
3 | | struct S<const C:() = {}>() where S<{}>:;
| |_________________________________________^ consider adding a `main` function to `lib.rs`
error: internal compiler error: compiler/rustc_middle/src/ty/subst.rs:592:17: const parameter `C/#0` (Const { ty: (), val: Param(C/#0) }/0) out of range when substituting substs=[]
thread 'rustc' panicked at 'Box<dyn Any>', /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a/compiler/rustc_errors/src/lib.rs:1115:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
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.59.0 (9d1b2106e 2022-02-23) running on x86_64-unknown-linux-gnu
query stack during panic:
#0 [check_item_well_formed] checking that `S` is well-formed
#1 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 3 previous errors; 1 warning emitted
Some errors have detailed explanations: E0554, E0601.
For more information about an error, try `rustc --explain E0554`.
Backtrace
stack backtrace:
0: std::panicking::begin_panic::<rustc_errors::ExplicitBug>
1: std::panic::panic_any::<rustc_errors::ExplicitBug>
2: <rustc_errors::HandlerInner>::span_bug::<rustc_span::span_encoding::Span>
3: <rustc_errors::Handler>::span_bug::<rustc_span::span_encoding::Span>
4: rustc_middle::ty::context::tls::with_opt::<rustc_middle::util::bug::opt_span_bug_fmt<rustc_span::span_encoding::Span>::{closure#0}, ()>
5: rustc_middle::util::bug::opt_span_bug_fmt::<rustc_span::span_encoding::Span>
6: rustc_middle::util::bug::span_bug_fmt::<rustc_span::span_encoding::Span>
7: <&rustc_middle::ty::consts::Const as rustc_middle::ty::fold::TypeFoldable>::try_fold_with::<rustc_middle::ty::subst::SubstFolder>
8: <&rustc_middle::ty::consts::Const as rustc_middle::ty::fold::TypeFoldable>::super_fold_with::<rustc_middle::ty::subst::SubstFolder>
9: <&rustc_middle::ty::TyS as rustc_middle::ty::fold::TypeFoldable>::super_fold_with::<rustc_middle::ty::subst::SubstFolder>
10: <alloc::vec::Vec<rustc_middle::ty::Predicate> as alloc::vec::spec_extend::SpecExtend<rustc_middle::ty::Predicate, core::iter::adapters::map::Map<core::slice::iter::Iter<(rustc_middle::ty::Predicate, rustc_span::span_encoding::Span)>, <rustc_middle::ty::generics::GenericPredicates>::instantiate_into::{closure#0}>>>::spec_extend
11: <rustc_middle::ty::generics::GenericPredicates>::instantiate_into
12: <rustc_middle::ty::generics::GenericPredicates>::instantiate
13: <rustc_trait_selection::traits::wf::WfPredicates>::nominal_obligations
14: <rustc_trait_selection::traits::wf::WfPredicates>::compute
15: <rustc_trait_selection::traits::fulfill::FulfillProcessor>::progress_changed_obligations
16: <rustc_data_structures::obligation_forest::ObligationForest<rustc_trait_selection::traits::fulfill::PendingPredicateObligation>>::process_obligations::<rustc_trait_selection::traits::fulfill::FulfillProcessor, rustc_data_structures::obligation_forest::Outcome<rustc_trait_selection::traits::fulfill::PendingPredicateObligation, rustc_infer::traits::FulfillmentErrorCode>>
17: <rustc_trait_selection::traits::fulfill::FulfillmentContext as rustc_infer::traits::engine::TraitEngine>::select_all_or_error
18: <rustc_typeck::check::fn_ctxt::FnCtxt>::select_all_obligations_or_error
19: <rustc_infer::infer::InferCtxtBuilder>::enter::<(), <rustc_typeck::check::inherited::InheritedBuilder>::enter<<rustc_typeck::check::wfcheck::CheckWfFcxBuilder>::with_fcx<rustc_typeck::check::wfcheck::check_type_defn<rustc_typeck::check::wfcheck::check_item_well_formed::{closure#2}>::{closure#0}>::{closure#0}, ()>::{closure#0}>
20: rustc_typeck::check::wfcheck::check_item_well_formed
21: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::plumbing::QueryCtxt, rustc_query_system::query::caches::DefaultCache<rustc_span::def_id::LocalDefId, ()>>
22: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::check_item_well_formed
23: rustc_data_structures::sync::par_for_each_in::<&alloc::vec::Vec<core::option::Option<rustc_hir::hir::OwnerInfo>>, <rustc_middle::hir::map::Map>::par_visit_all_item_likes<rustc_typeck::check::wfcheck::CheckTypeWellFormedVisitor>::{closure#0}>
24: <rustc_session::session::Session>::track_errors::<rustc_typeck::check_crate::{closure#5}, ()>
25: rustc_typeck::check_crate
26: rustc_interface::passes::analysis
27: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::plumbing::QueryCtxt, rustc_query_system::query::caches::DefaultCache<(), core::result::Result<(), rustc_errors::ErrorReported>>>
28: rustc_query_system::query::plumbing::get_query::<rustc_query_impl::queries::analysis, rustc_query_impl::plumbing::QueryCtxt>
29: <rustc_interface::interface::Compiler>::enter::<rustc_driver::run_compiler::{closure#1}::{closure#2}, core::result::Result<core::option::Option<rustc_interface::queries::Linker>, rustc_errors::ErrorReported>>
30: rustc_span::with_source_map::<core::result::Result<(), rustc_errors::ErrorReported>, rustc_interface::interface::create_compiler_and_run<core::result::Result<(), rustc_errors::ErrorReported>, rustc_driver::run_compiler::{closure#1}>::{closure#1}>
31: rustc_interface::interface::create_compiler_and_run::<core::result::Result<(), rustc_errors::ErrorReported>, rustc_driver::run_compiler::{closure#1}>
32: <scoped_tls::ScopedKey<rustc_span::SessionGlobals>>::set::<rustc_interface::util::setup_callbacks_and_run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorReported>, rustc_driver::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_errors::ErrorReported>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_errors::ErrorReported>>