Closed
Description
The following ICE's on nightly only:
use std::marker::PhantomData;
struct B<const I: u8>;
impl B<0> {
fn bug() -> Self {
panic!()
}
}
Notice I didn't specify the #![feature(const_generics)]
feature
Backtrace:
Compiling playground v0.0.1 (/playground)
error[E0658]: const generics are unstable
--> src/lib.rs:23:16
|
23 | struct B<const I: u8>;
| ^
|
= note: for more information, see https://github.com/rust-lang/rust/issues/44580
= help: add #![feature(const_generics)] to the crate attributes to enable
warning: unused import: `std::marker::PhantomData`
--> src/lib.rs:21:5
|
21 | use std::marker::PhantomData;
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: #[warn(unused_imports)] on by default
thread 'rustc' panicked at 'not yet implemented', src/librustc/ty/relate.rs:707:17
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
stack backtrace:
0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
at src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:39
1: std::sys_common::backtrace::_print
at src/libstd/sys_common/backtrace.rs:71
2: std::panicking::default_hook::{{closure}}
at src/libstd/sys_common/backtrace.rs:59
at src/libstd/panicking.rs:197
3: std::panicking::default_hook
at src/libstd/panicking.rs:211
4: rustc::util::common::panic_hook
5: std::panicking::rust_panic_with_hook
at src/libstd/panicking.rs:478
6: std::panicking::begin_panic
7: <rustc::ty::subst::Kind as rustc::ty::relate::Relate>::relate
8: core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &mut F>::call_once
9: <smallvec::SmallVec<A> as core::iter::traits::collect::FromIterator<<A as smallvec::Array>::Item>>::from_iter
10: <core::result::Result<T,E> as rustc::ty::context::InternIteratorElement<T,R>>::intern_with
11: <rustc::infer::combine::Generalizer as rustc::ty::relate::TypeRelation>::relate_item_substs
12: rustc::ty::relate::super_relate_tys
13: <rustc::infer::combine::Generalizer as rustc::ty::relate::TypeRelation>::tys
14: rustc::infer::combine::CombineFields::instantiate
15: <rustc::infer::sub::Sub as rustc::ty::relate::TypeRelation>::tys
16: rustc::infer::InferCtxt::commit_if_ok
17: rustc::infer::InferCtxt::commit_if_ok
18: rustc_typeck::check::coercion::Coerce::coerce_unsized
19: rustc::infer::InferCtxt::commit_if_ok
20: rustc_typeck::check::coercion::Coerce::coerce
21: rustc::infer::InferCtxt::commit_if_ok
22: rustc_typeck::check::coercion::<impl rustc_typeck::check::FnCtxt>::try_coerce
23: rustc_typeck::check::coercion::CoerceMany<E>::coerce_inner
24: rustc_typeck::check::FnCtxt::check_block_with_expected
25: rustc_typeck::check::FnCtxt::check_expr_kind
26: rustc_typeck::check::FnCtxt::check_expr_with_expectation_and_needs
27: rustc_typeck::check::FnCtxt::check_block_with_expected
28: rustc_typeck::check::FnCtxt::check_expr_kind
29: rustc_typeck::check::FnCtxt::check_expr_with_expectation_and_needs
30: rustc_typeck::check::FnCtxt::check_return_expr
31: rustc_typeck::check::check_fn
32: rustc::ty::context::GlobalCtxt::enter_local
33: rustc_typeck::check::typeck_tables_of
34: rustc::ty::query::__query_compute::typeck_tables_of
35: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors for rustc::ty::query::queries::typeck_tables_of>::compute
36: rustc::dep_graph::graph::DepGraph::with_task_impl
37: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
38: rustc::ty::<impl rustc::ty::context::TyCtxt>::par_body_owners
39: rustc_typeck::check::typeck_item_bodies
40: rustc::ty::query::__query_compute::typeck_item_bodies
41: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors for rustc::ty::query::queries::typeck_item_bodies>::compute
42: rustc::dep_graph::graph::DepGraph::with_task_impl
43: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
44: rustc::util::common::time
45: rustc_typeck::check_crate
46: rustc_interface::passes::analysis
47: rustc::ty::query::__query_compute::analysis
48: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors for rustc::ty::query::queries::analysis>::compute
49: rustc::dep_graph::graph::DepGraph::with_task_impl
50: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
51: rustc_interface::passes::BoxedGlobalCtxt::access::{{closure}}
52: rustc_interface::passes::create_global_ctxt::{{closure}}
53: rustc_interface::passes::BoxedGlobalCtxt::enter
54: rustc_interface::interface::run_compiler_in_existing_thread_pool
55: std::thread::local::LocalKey<T>::with
56: scoped_tls::ScopedKey<T>::set
57: syntax::with_globals
query stack during panic:
#0 [typeck_tables_of] processing `B::<_>::bug`
#1 [typeck_item_bodies] type-checking all item bodies
#2 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to previous error
For more information about this error, try `rustc --explain E0658`.
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/blob/master/CONTRIBUTING.md#bug-reports
note: rustc 1.36.0-nightly (e305df184 2019-04-24) running on x86_64-unknown-linux-gnu
note: compiler flags: -C codegen-units=1 -C debuginfo=2 --crate-type lib
note: some of the compiler flags provided by cargo are hidden
error: Could not compile `playground`.
To learn more, run the command again with --verbose.