Enum variants shadow associated constants with no warning #117558
Labels
A-lints
Area: Lints (warnings about flaws in source code) such as unused_mut.
C-enhancement
Category: An issue proposing an enhancement or a PR with one.
User Story
As a rust newbie, I don't know which one is recommended.
or
impl FooEnum
or
impl FooEnumWrapperStruct
So, I check doc
https://doc.rust-lang.org/stable/rust-by-example/custom_types/enum/testcase_linked_list.html
Found
impl FooEnum
, notimpl FooEnumWrapperStruct
Curiously, I tried this code:
I expected to see this happen:
or same name is treated invalid: compile failure,
pub const A
conflicts withFoo:A
or same name is treated valid: there should be
core::get_enum_impl_pub_const(Foo, "A")
equals to 42Instead, this happened:
Meta
rustc --version --verbose
:Backtrace
The text was updated successfully, but these errors were encountered: