Closed
Description
Code
struct S;
fn f() {
S::A::<f> {}
}
Meta
rustc --version --verbose
:
rustc 1.49.0-nightly (ffa2e7ae8 2020-10-24)
binary: rustc
commit-hash: ffa2e7ae8fbf9badc035740db949b9dae271c29f
commit-date: 2020-10-24
host: x86_64-unknown-linux-gnu
release: 1.49.0-nightly
LLVM version: 11.0
Error output
error[E0601]: `main` function not found in crate `reduced_mutant`
--> reduced_mutant.rs:1:1
|
1 | / struct S;
2 | | fn f() {
3 | | S::A::<f> {}
4 | | }
| |_^ consider adding a `main` function to `reduced_mutant.rs`
error[E0223]: ambiguous associated type
--> reduced_mutant.rs:3:5
|
3 | S::A::<f> {}
| ^^^^^^^^^ help: use fully-qualified syntax: `<S as Trait>::A`
error: internal compiler error: compiler/rustc_typeck/src/collect/type_of.rs:82:26: unexpected const parent path Expr(Expr { hir_id: HirId { owner: DefId(0:5 ~ reduced_mutant[317d]::f), local_id: 7 }, kind: Struct(TypeRelative(Ty { hir_id: HirId { owner: DefId(0:5 ~ reduced_mutant[317d]::f), local_id: 2 }, kind: Path(Resolved(None, Path { span: reduced_mutant.rs:3:5: 3:14 (#0), res: Def(Struct, DefId(0:3 ~ reduced_mutant[317d]::S)), segments: [PathSegment { ident: S#0, hir_id: Some(HirId { owner: DefId(0:5 ~ reduced_mutant[317d]::f), local_id: 1 }), res: Some(Err), args: None, infer_args: true }] })), span: reduced_mutant.rs:3:5: 3:14 (#0) }, PathSegment { ident: A#0, hir_id: Some(HirId { owner: DefId(0:5 ~ reduced_mutant[317d]::f), local_id: 6 }), res: Some(Err), args: Some(GenericArgs { args: [Const(ConstArg { value: AnonConst { hir_id: HirId { owner: DefId(0:5 ~ reduced_mutant[317d]::f), local_id: 3 }, body: BodyId { hir_id: HirId { owner: DefId(0:5 ~ reduced_mutant[317d]::f), local_id: 5 } } }, span: reduced_mutant.rs:3:12: 3:13 (#0) })], bindings: [], parenthesized: false }), infer_args: false }), [], None), attrs: ThinVec(None), span: reduced_mutant.rs:3:5: 3:17 (#0) })
thread 'rustc' panicked at 'Box<Any>', /rustc/ffa2e7ae8fbf9badc035740db949b9dae271c29f/compiler/rustc_errors/src/lib.rs:891: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 (ffa2e7ae8 2020-10-24) running on x86_64-unknown-linux-gnu
query stack during panic:
#0 [opt_const_param_of] computing the optional const parameter of `f::{constant#0}`
#1 [typeck] type-checking `f::{constant#0}`
end of query stack
error: aborting due to 3 previous errors
Some errors have detailed explanations: E0223, E0601.
For more information about an error, try `rustc --explain E0223`.
Backtrace
thread 'rustc' panicked at 'Box<Any>', /rustc/ffa2e7ae8fbf9badc035740db949b9dae271c29f/compiler/rustc_errors/src/lib.rs:891:9
stack backtrace:
0: std::panicking::begin_panic
1: rustc_errors::HandlerInner::span_bug
2: rustc_errors::Handler::span_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::span_bug_fmt
8: rustc_typeck::collect::type_of::opt_const_param_of
9: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::opt_const_param_of>::compute
10: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
11: rustc_data_structures::stack::ensure_sufficient_stack
12: rustc_query_system::query::plumbing::get_query_impl
13: rustc_typeck::check::typeck
14: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::typeck>::compute
15: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
16: rustc_data_structures::stack::ensure_sufficient_stack
17: rustc_query_system::query::plumbing::get_query_impl
18: rustc_query_system::query::plumbing::ensure_query_impl
19: rustc_typeck::check::typeck_item_bodies
20: 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
21: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
22: rustc_data_structures::stack::ensure_sufficient_stack
23: rustc_query_system::query::plumbing::get_query_impl
24: rustc_typeck::check_crate
25: rustc_interface::passes::analysis
26: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::analysis>::compute
27: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
28: rustc_middle::ty::query::plumbing::<impl rustc_query_system::query::QueryContext for rustc_middle::ty::context::TyCtxt>::start_query::{{closure}}::{{closure}}::{{closure}}
29: rustc_query_system::query::plumbing::get_query_impl
30: rustc_interface::passes::QueryContext::enter
31: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
32: rustc_span::with_source_map
33: rustc_interface::interface::create_compiler_and_run
34: scoped_tls::ScopedKey<T>::set
NOTE: The bug is found by our work-in-progress compiler testing tool Kira, and the test program is reduced/minimized by Perses