Skip to content

Commit 395d1ac

Browse files
committed
rustc: Enum idents are not in the value namespace. Closes #3186
1 parent 28cd0ad commit 395d1ac

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

src/rustc/middle/resolve3.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -972,10 +972,10 @@ class Resolver {
972972
(*name_bindings).define_type(def_ty(local_def(item.id)), sp);
973973
}
974974

975-
// These items live in both the type and value namespaces.
976975
item_enum(enum_definition, _) => {
976+
977977
let (name_bindings, new_parent) = self.add_child(atom, parent,
978-
~[ValueNS, TypeNS], sp);
978+
~[TypeNS], sp);
979979

980980
(*name_bindings).define_type(def_ty(local_def(item.id)), sp);
981981

@@ -986,6 +986,8 @@ class Resolver {
986986
visitor);
987987
}
988988
}
989+
990+
// These items live in both the type and value namespaces.
989991
item_class(struct_definition, _) => {
990992
let (name_bindings, new_parent) =
991993
match struct_definition.ctor {

src/test/run-pass/issue-3186.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
enum y { x }
2+
3+
enum x {}
4+
5+
fn main() {}

0 commit comments

Comments
 (0)