Closed
Description
Code
fn main() {
[1; <Multiply<Five, Five>>::VAL];
}
trait TypeVal<T> {
const VAL: T;
}
struct Five;
struct Multiply<N, M> {
_n: PhantomData,
}
impl<N, M> TypeVal<usize> for Multiply<N, M> where N: TypeVal<VAL> {}
Meta
rustc --version --verbose
:
rustc 1.49.0-nightly (8dae8cdcc 2020-10-12)
binary: rustc
commit-hash: 8dae8cdcc8fa879cea6a4bbbfa5b32e97be4c306
commit-date: 2020-10-12
host: x86_64-unknown-linux-gnu
release: 1.49.0-nightly
LLVM version: 11.0
Error output
error[E0412]: cannot find type `PhantomData` in this scope
--> reduced_mutant.rs:9:9
|
9 | _n: PhantomData,
| ^^^^^^^^^^^ not found in this scope
|
help: consider importing this struct
|
1 | use std::marker::PhantomData;
|
error[E0412]: cannot find type `VAL` in this scope
--> reduced_mutant.rs:11:63
|
11 | impl<N, M> TypeVal<usize> for Multiply<N, M> where N: TypeVal<VAL> {}
| - ^^^ not found in this scope
| |
| help: you might be missing a type parameter: `, VAL`
error[E0046]: not all trait items implemented, missing: `VAL`
--> reduced_mutant.rs:11:1
|
5 | const VAL: T;
| ------------- `VAL` from trait
...
11 | impl<N, M> TypeVal<usize> for Multiply<N, M> where N: TypeVal<VAL> {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `VAL` in implementation
error: internal compiler error: compiler/rustc_trait_selection/src/traits/codegen/mod.rs:121:9: Encountered errors `[FulfillmentError(Obligation(predicate=TraitPredicate(<Five as TypeVal<[type error]>>), depth=1),Ambiguity)]` resolving bounds after type-checking
thread 'rustc' panicked at 'Box<Any>', compiler/rustc_errors/src/lib.rs:945: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.49.0-nightly (8dae8cdcc 2020-10-12) running on x86_64-unknown-linux-gnu
error: aborting due to 4 previous errors
Some errors have detailed explanations: E0046, E0412.
For more information about an error, try `rustc --explain E0046`.
Backtrace
thread 'rustc' panicked at 'Box<Any>', compiler/rustc_errors/src/lib.rs:945:9
stack backtrace:
0: std::panicking::begin_panic
1: rustc_errors::HandlerInner::bug
2: rustc_errors::Handler::bug
3: rustc_middle::util::bug::opt_span_bug_fmt::{{closure}}
4: rustc_middle::ty::context::tls::with_opt::{{closure}}
5: rustc_middle::ty::context::tls::with_opt
6: rustc_middle::util::bug::opt_span_bug_fmt
7: rustc_middle::util::bug::bug_fmt
8: rustc_trait_selection::traits::codegen::drain_fulfillment_cx_or_panic
9: rustc_infer::infer::InferCtxtBuilder::enter
10: rustc_trait_selection::traits::codegen::codegen_fulfill_obligation
11: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::codegen_fulfill_obligation>::compute
12: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
13: rustc_data_structures::stack::ensure_sufficient_stack
14: rustc_query_system::query::plumbing::get_query_impl
15: rustc_ty::instance::inner_resolve_instance
16: rustc_ty::instance::resolve_instance
17: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::resolve_instance>::compute
18: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
19: rustc_data_structures::stack::ensure_sufficient_stack
20: rustc_query_system::query::plumbing::get_query_impl
21: rustc_middle::ty::instance::Instance::resolve_opt_const_arg
22: rustc_middle::mir::interpret::queries::<impl rustc_middle::ty::context::TyCtxt>::const_eval_resolve
23: rustc_middle::ty::consts::Const::eval
24: <rustc_infer::infer::at::At as rustc_trait_selection::traits::query::normalize::AtExt>::normalize
25: rustc_infer::infer::InferCtxtBuilder::enter
26: rustc_traits::normalize_erasing_regions::normalize_generic_arg_after_erasing_regions
27: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
28: rustc_data_structures::stack::ensure_sufficient_stack
29: rustc_query_system::query::plumbing::get_query_impl
30: <rustc_middle::ty::normalize_erasing_regions::NormalizeAfterErasingRegionsFolder as rustc_middle::ty::fold::TypeFolder>::fold_const
31: rustc_middle::ty::normalize_erasing_regions::<impl rustc_middle::ty::context::TyCtxt>::subst_and_normalize_erasing_regions
32: rustc_mir::interpret::eval_context::InterpCx<M>::push_stack_frame
33: rustc_mir::const_eval::eval_queries::eval_to_allocation_raw_provider
34: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::eval_to_allocation_raw>::compute
35: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
36: rustc_data_structures::stack::ensure_sufficient_stack
37: rustc_query_system::query::plumbing::get_query_impl
38: rustc_mir::const_eval::eval_queries::eval_to_const_value_raw_provider
39: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::eval_to_const_value_raw>::compute
40: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
41: rustc_data_structures::stack::ensure_sufficient_stack
42: rustc_query_system::query::plumbing::get_query_impl
43: rustc_middle::mir::interpret::queries::<impl rustc_middle::ty::context::TyCtxt>::const_eval_global_id
44: rustc_middle::mir::interpret::queries::<impl rustc_middle::ty::context::TyCtxt>::const_eval_resolve
45: rustc_infer::infer::InferCtxt::const_eval_resolve
46: rustc_trait_selection::traits::const_evaluatable::is_const_evaluatable
47: rustc_trait_selection::traits::fulfill::FulfillProcessor::progress_changed_obligations
48: rustc_data_structures::obligation_forest::ObligationForest<O>::process_obligations
49: <rustc_trait_selection::traits::fulfill::FulfillmentContext as rustc_infer::traits::engine::TraitEngine>::select_where_possible
50: rustc_typeck::check::fn_ctxt::FnCtxt::select_obligations_where_possible
51: rustc_infer::infer::InferCtxtBuilder::enter
52: rustc_typeck::check::typeck
53: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::typeck>::compute
54: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
55: rustc_data_structures::stack::ensure_sufficient_stack
56: rustc_query_system::query::plumbing::get_query_impl
57: rustc_query_system::query::plumbing::ensure_query_impl
58: rustc_typeck::check::typeck_item_bodies
59: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::typeck_item_bodies>::compute
60: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
61: rustc_data_structures::stack::ensure_sufficient_stack
62: rustc_query_system::query::plumbing::get_query_impl
63: rustc_typeck::check_crate
64: rustc_interface::passes::analysis
65: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::analysis>::compute
66: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
67: rustc_data_structures::stack::ensure_sufficient_stack
68: rustc_query_system::query::plumbing::get_query_impl
69: rustc_interface::passes::QueryContext::enter
70: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
71: rustc_span::with_source_map
72: scoped_tls::ScopedKey<T>::set
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose 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.49.0-nightly (8dae8cdcc 2020-10-12) running on x86_64-unknown-linux-gnu
query stack during panic:
#0 [codegen_fulfill_obligation] checking if `TypeVal` fulfills its obligations
#1 [resolve_instance] resolving instance `<Multiply<Five, Five> as TypeVal<usize>>::VAL`
#2 [normalize_generic_arg_after_erasing_regions] normalizing `<Multiply<Five, Five> as TypeVal<usize>>::VAL`
#3 [eval_to_allocation_raw] const-evaluating + checking `main::{constant#0}`
#4 [eval_to_const_value_raw] simplifying constant for the type system `main::{constant#0}`
#5 [typeck] type-checking `main`
#6 [typeck_item_bodies] type-checking all item bodies
#7 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 4 previous errors
Some errors have detailed explanations: E0046, E0412.
For more information about an error, try `rustc --explain E0046`.
NOTE: The bug is found by our work-in-progress compiler testing tool Kira, and the test program is reduced/minimized by Perses
Metadata
Metadata
Assignees
Labels
Area: Trait systemCategory: This is a bug.Call for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustcIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Medium priorityRelevant to the compiler team, which will review and decide on the PR/issue.ICE tracked in rust-lang/glacier.Performance or correctness regression from one stable version to another.