Skip to content

Commit a697210

Browse files
committed
Hide unexported tag variants
1 parent 459b0ec commit a697210

File tree

2 files changed

+22
-3
lines changed

2 files changed

+22
-3
lines changed

src/comp/middle/resolve.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -407,9 +407,11 @@ fn lookup_name_wrapped(&env e, ast.ident i, namespace ns)
407407
case (ast.mie_tag_variant(?item, ?variant_idx)) {
408408
alt (item.node) {
409409
case (ast.item_tag(_, ?variants, _, ?tid, _)) {
410-
auto vid = variants.(variant_idx).node.id;
411-
auto t = ast.def_variant(tid, vid);
412-
ret some[def_wrap](def_wrap_other(t));
410+
if (visible(e, i, m)) {
411+
auto vid = variants.(variant_idx).node.id;
412+
auto t = ast.def_variant(tid, vid);
413+
ret some[def_wrap](def_wrap_other(t));
414+
}
413415
}
414416
case (_) {
415417
log_err "tag item not actually a tag";
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// xfail-boot
2+
// error-pattern: unresolved name
3+
4+
mod foo {
5+
export x;
6+
7+
fn x() {
8+
}
9+
10+
tag y {
11+
y1;
12+
}
13+
}
14+
15+
fn main() {
16+
auto z = foo.y1;
17+
}

0 commit comments

Comments
 (0)