Closed
Description
Code
trait u32 {
const CONST: u32;
}
Meta
rustc --version --verbose
:
rustc 1.56.0-nightly (9c25eb7aa 2021-07-25)
binary: rustc
commit-hash: 9c25eb7aa3a71fb951564b0ddf131be59c2c951d
commit-date: 2021-07-25
host: x86_64-unknown-linux-gnu
release: 1.56.0-nightly
LLVM version: 12.0.1
Error output
warning: trait `u32` should have an upper camel case name
--> mutant.rs:1:7
|
1 | trait u32 {
| ^^^ help: convert the identifier to upper camel case (notice the capitalization): `U32`
|
= note: `#[warn(non_camel_case_types)]` on by default
warning: trait objects without an explicit `dyn` are deprecated
--> mutant.rs:2:18
|
2 | const CONST: u32;
| ^^^ help: use `dyn`: `dyn u32`
|
= note: `#[warn(bare_trait_objects)]` on by default
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
= note: for more information, see issue #80165 <https://github.com/rust-lang/rust/issues/80165>
error: associated item referring to unboxed trait object for its own trait
--> mutant.rs:2:18
|
1 | trait u32 {
| --- in this trait
2 | const CONST: u32;
| ^^^
|
help: you might have meant to use `Self` to refer to the implementing type
|
2 | const CONST: Self;
| ^^^^
error: internal compiler error: compiler/rustc_typeck/src/hir_wf_check.rs:133:29: Unexpected TraitItem Const(Ty { hir_id: HirId { owner: DefId(0:4 ~ mutant[d0c6]::u32::CONST), local_id: 3 }, kind: TraitObject([PolyTraitRef { bound_generic_params: [], trait_ref: TraitRef { path: Path { span: mutant.rs:2:18: 2:21 (#0), res: Def(Trait, DefId(0:3 ~ mutant[d0c6]::u32)), segments: [PathSegment { ident: u32#0, hir_id: Some(HirId { owner: DefId(0:4 ~ mutant[d0c6]::u32::CONST), local_id: 2 }), res: Some(Def(Trait, DefId(0:3 ~ mutant[d0c6]::u32))), args: None, infer_args: false }] }, hir_ref_id: HirId { owner: DefId(0:4 ~ mutant[d0c6]::u32::CONST), local_id: 1 } }, span: mutant.rs:2:18: 2:21 (#0) }], lifetime(HirId { owner: DefId(0:4 ~ mutant[d0c6]::u32::CONST), local_id: 4 }: ), None), span: mutant.rs:2:18: 2:21 (#0) }, None)
thread 'rustc' panicked at 'Box<dyn Any>', compiler/rustc_errors/src/lib.rs:1034: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.56.0-nightly (9c25eb7aa 2021-07-25) running on x86_64-unknown-linux-gnu
note: compiler flags: --crate-type staticlib
query stack during panic:
#0 [diagnostic_hir_wf_check] performing HIR wf-checking for predicate Binder(ObjectSafe(DefId(0:3 ~ mutant[d0c6]::u32)), []) at item Ty(DefId(0:4 ~ mutant[d0c6]::u32::CONST))
#1 [check_trait_item_well_formed] checking that `u32::CONST` is well-formed
end of query stack
error: aborting due to 2 previous errors; 2 warnings emitted
Backtrace
warning: trait `u32` should have an upper camel case name
--> mutant.rs:1:7
|
1 | trait u32 {
| ^^^ help: convert the identifier to upper camel case (notice the capitalization): `U32`
|
= note: `#[warn(non_camel_case_types)]` on by default
warning: trait objects without an explicit `dyn` are deprecated
--> mutant.rs:2:18
|
2 | const CONST: u32;
| ^^^ help: use `dyn`: `dyn u32`
|
= note: `#[warn(bare_trait_objects)]` on by default
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
= note: for more information, see issue #80165 <https://github.com/rust-lang/rust/issues/80165>
error: associated item referring to unboxed trait object for its own trait
--> mutant.rs:2:18
|
1 | trait u32 {
| --- in this trait
2 | const CONST: u32;
| ^^^
|
help: you might have meant to use `Self` to refer to the implementing type
|
2 | const CONST: Self;
| ^^^^
error: internal compiler error: compiler/rustc_typeck/src/hir_wf_check.rs:133:29: Unexpected TraitItem Const(Ty { hir_id: HirId { owner: DefId(0:4 ~ mutant[d0c6]::u32::CONST), local_id: 3 }, kind: TraitObject([PolyTraitRef { bound_generic_params: [], trait_ref: TraitRef { path: Path { span: mutant.rs:2:18: 2:21 (#0), res: Def(Trait, DefId(0:3 ~ mutant[d0c6]::u32)), segments: [PathSegment { ident: u32#0, hir_id: Some(HirId { owner: DefId(0:4 ~ mutant[d0c6]::u32::CONST), local_id: 2 }), res: Some(Def(Trait, DefId(0:3 ~ mutant[d0c6]::u32))), args: None, infer_args: false }] }, hir_ref_id: HirId { owner: DefId(0:4 ~ mutant[d0c6]::u32::CONST), local_id: 1 } }, span: mutant.rs:2:18: 2:21 (#0) }], lifetime(HirId { owner: DefId(0:4 ~ mutant[d0c6]::u32::CONST), local_id: 4 }: ), None), span: mutant.rs:2:18: 2:21 (#0) }, None)
thread 'rustc' panicked at 'Box<dyn Any>', compiler/rustc_errors/src/lib.rs:1034: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_typeck::hir_wf_check::diagnostic_hir_wf_check
8: rustc_query_system::query::plumbing::get_query_impl
9: rustc_query_system::query::plumbing::get_query
10: <rustc_infer::infer::InferCtxt as rustc_trait_selection::traits::error_reporting::InferCtxtExt>::report_selection_error
11: <rustc_infer::infer::InferCtxt as rustc_trait_selection::traits::error_reporting::InferCtxtPrivExt>::report_fulfillment_error
12: <rustc_infer::infer::InferCtxt as rustc_trait_selection::traits::error_reporting::InferCtxtExt>::report_fulfillment_errors
13: rustc_typeck::check::fn_ctxt::_impl::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::select_all_obligations_or_error
14: rustc_infer::infer::InferCtxtBuilder::enter
15: rustc_typeck::check::wfcheck::check_associated_item
16: rustc_typeck::check::wfcheck::check_trait_item
17: rustc_query_system::query::plumbing::get_query_impl
18: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::check_trait_item_well_formed
19: <rustc_typeck::check::wfcheck::CheckTypeWellFormedVisitor as rustc_hir::intravisit::Visitor>::visit_trait_item
20: std::panicking::try
21: rustc_data_structures::sync::par_for_each_in
22: rustc_session::session::Session::track_errors
23: rustc_typeck::check_crate
24: rustc_interface::passes::analysis
25: rustc_query_system::query::plumbing::get_query_impl
26: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::analysis
27: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
28: rustc_span::with_source_map
29: rustc_interface::interface::create_compiler_and_run
30: 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.56.0-nightly (9c25eb7aa 2021-07-25) running on x86_64-unknown-linux-gnu
note: compiler flags: --crate-type staticlib
query stack during panic:
#0 [diagnostic_hir_wf_check] performing HIR wf-checking for predicate Binder(ObjectSafe(DefId(0:3 ~ mutant[d0c6]::u32)), []) at item Ty(DefId(0:4 ~ mutant[d0c6]::u32::CONST))
#1 [check_trait_item_well_formed] checking that `u32::CONST` is well-formed
#2 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 2 previous errors; 2 warnings emitted