Skip to content

Commit 439deed

Browse files
committed
---
yaml --- r: 138600 b: refs/heads/try2 c: f2837fa h: refs/heads/master v: v3
1 parent 729d1da commit 439deed

File tree

3 files changed

+19
-7
lines changed

3 files changed

+19
-7
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: 94a07b6e4adbe0c2cd49673d58641852390f5639
8+
refs/heads/try2: f2837fa3f53b304b5c9a79d733dfd56da5f32637
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/src/librustc/middle/resolve.rs

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -622,6 +622,19 @@ pub impl NameBindings {
622622
}
623623
}
624624
625+
fn defined_in_public_namespace(namespace: Namespace) -> bool {
626+
match namespace {
627+
TypeNS => match self.type_def {
628+
Some(def) => def.privacy != Private,
629+
None => false
630+
},
631+
ValueNS => match self.value_def {
632+
Some(def) => def.privacy != Private,
633+
None => false
634+
}
635+
}
636+
}
637+
625638
fn def_for_namespace(namespace: Namespace) -> Option<def> {
626639
match namespace {
627640
TypeNS => {
@@ -2538,7 +2551,6 @@ pub impl Resolver {
25382551
}
25392552
}
25402553

2541-
25422554
debug!("(resolving glob import) writing resolution `%s` in `%s` \
25432555
to `%s`, privacy=%?",
25442556
*self.session.str_of(ident),
@@ -2547,12 +2559,12 @@ pub impl Resolver {
25472559
dest_import_resolution.privacy);
25482560

25492561
// Merge the child item into the import resolution.
2550-
if (*name_bindings).defined_in_namespace(ValueNS) {
2562+
if (*name_bindings).defined_in_public_namespace(ValueNS) {
25512563
debug!("(resolving glob import) ... for value target");
25522564
dest_import_resolution.value_target =
25532565
Some(Target(containing_module, name_bindings));
25542566
}
2555-
if (*name_bindings).defined_in_namespace(TypeNS) {
2567+
if (*name_bindings).defined_in_public_namespace(TypeNS) {
25562568
debug!("(resolving glob import) ... for type target");
25572569
dest_import_resolution.type_target =
25582570
Some(Target(containing_module, name_bindings));

branches/try2/src/test/compile-fail/issue-4366.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ mod a {
2323
}
2424
pub mod sub {
2525
use a::b::*;
26-
fn sub() -> bar { foo(); 1 } //~ ERROR: unresolved name: foo
27-
//~^ ERROR: unresolved name: bar
26+
fn sub() -> bar { foo(); 1 } //~ ERROR: unresolved name: `foo`
27+
//~^ ERROR: use of undeclared type name `bar`
2828
}
2929
}
3030

@@ -34,6 +34,6 @@ mod m1 {
3434
use m1::*;
3535

3636
fn main() {
37-
foo(); //~ ERROR: unresolved name: foo
37+
foo(); //~ ERROR: unresolved name: `foo`
3838
}
3939

0 commit comments

Comments
 (0)