Closed
Description
Code
trait T {
const T: usize = return;
}
Meta
rustc --version --verbose
:
rustc 1.55.0-nightly (a435b49e8 2021-06-28)
binary: rustc
commit-hash: a435b49e86d16e98dcc6595dd471f95e823f41aa
commit-date: 2021-06-28
host: x86_64-unknown-linux-gnu
release: 1.55.0-nightly
LLVM version: 12.0.1
Error output
error[E0601]: `main` function not found in crate `mutant`
--> mutant.rs:1:1
|
1 | / trait T {
2 | | const T: usize = return;
3 | | }
| |_^ consider adding a `main` function to `mutant.rs`
error: internal compiler error: compiler/rustc_middle/src/hir/map/mod.rs:744:18: expected item, found assoc constant T in T::T (hir_id=HirId { owner: DefId(0:4 ~ mutant[317d]::T::T), local_id: 0 })
thread 'rustc' panicked at 'Box<dyn Any>', compiler/rustc_errors/src/lib.rs:1007: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.55.0-nightly (a435b49e8 2021-06-28) running on x86_64-unknown-linux-gnu
query stack during panic:
#0 [typeck] type-checking `T::T`
#1 [typeck_item_bodies] type-checking all item bodies
end of query stack
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0601`.
Backtrace
error[E0601]: `main` function not found in crate `mutant`
--> mutant.rs:1:1
|
1 | / trait T {
2 | | const T: usize = return;
3 | | }
| |_^ consider adding a `main` function to `mutant.rs`
error: internal compiler error: compiler/rustc_middle/src/hir/map/mod.rs:744:18: expected item, found assoc constant T in T::T (hir_id=HirId { owner: DefId(0:4 ~ mutant[317d]::T::T), local_id: 0 })
thread 'rustc' panicked at 'Box<dyn Any>', compiler/rustc_errors/src/lib.rs:1007:9
stack backtrace:
0: std::panicking::begin_panic
1: std::panic::panic_any
2: rustc_errors::HandlerInner::bug
3: rustc_errors::Handler::bug
4: rustc_middle::ty::context::tls::with_opt
5: rustc_middle::util::bug::opt_span_bug_fmt
6: rustc_middle::util::bug::bug_fmt
7: rustc_middle::hir::map::Map::expect_item
8: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_kind
9: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation
10: rustc_infer::infer::InferCtxtBuilder::enter
11: rustc_typeck::check::typeck
12: rustc_query_system::query::plumbing::get_query_impl
13: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::typeck
14: rustc_middle::ty::<impl rustc_middle::ty::context::TyCtxt>::par_body_owners
15: rustc_typeck::check::typeck_item_bodies
16: rustc_query_system::query::plumbing::get_query_impl
17: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::typeck_item_bodies
18: rustc_session::utils::<impl rustc_session::session::Session>::time
19: rustc_typeck::check_crate
20: rustc_interface::passes::analysis
21: rustc_query_system::query::plumbing::get_query_impl
22: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::analysis
23: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
24: rustc_span::with_source_map
25: rustc_interface::interface::create_compiler_and_run
26: 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.55.0-nightly (a435b49e8 2021-06-28) running on x86_64-unknown-linux-gnu
query stack during panic:
#0 [typeck] type-checking `T::T`
#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 2 previous errors
For more information about this error, try `rustc --explain E0601`.