File tree 2 files changed +43
-1
lines changed
2 files changed +43
-1
lines changed Original file line number Diff line number Diff line change @@ -2480,7 +2480,7 @@ pub impl Resolver {
2480
2480
2481
2481
// Here we merge two import resolutions.
2482
2482
match module_. import_resolutions . find ( & ident) {
2483
- None => {
2483
+ None if target_import_resolution . privacy == Public => {
2484
2484
// Simple: just copy the old import resolution.
2485
2485
let new_import_resolution =
2486
2486
@mut ImportResolution ( privacy,
@@ -2494,6 +2494,7 @@ pub impl Resolver {
2494
2494
module_. import_resolutions . insert
2495
2495
( ident, new_import_resolution) ;
2496
2496
}
2497
+ None => { /* continue ... */ }
2497
2498
Some ( dest_import_resolution) => {
2498
2499
// Merge the two import resolutions at a finer-grained
2499
2500
// level.
@@ -2756,6 +2757,8 @@ pub impl Resolver {
2756
2757
namespace) ;
2757
2758
}
2758
2759
Some ( target) => {
2760
+ debug ! ( "(resolving item in lexical scope) using \
2761
+ import resolution") ;
2759
2762
import_resolution. state . used = true ;
2760
2763
return Success ( copy target) ;
2761
2764
}
Original file line number Diff line number Diff line change
1
+ // Copyright 2013 The Rust Project Developers. See the COPYRIGHT
2
+ // file at the top-level directory of this distribution and at
3
+ // http://rust-lang.org/COPYRIGHT.
4
+ //
5
+ // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6
+ // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7
+ // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8
+ // option. This file may not be copied, modified, or distributed
9
+ // except according to those terms.
10
+
11
+ // regression test for issue 4366
12
+
13
+ // ensures that 'use foo:*' doesn't import non-public 'use' statements in the
14
+ // module 'foo'
15
+
16
+ mod foo {
17
+ pub fn foo ( ) { }
18
+ }
19
+ mod a {
20
+ pub mod b {
21
+ use foo:: foo;
22
+ type bar = int ;
23
+ }
24
+ pub mod sub {
25
+ use a:: b:: * ;
26
+ fn sub ( ) -> bar { foo ( ) ; 1 } //~ ERROR: unresolved name: foo
27
+ //~^ ERROR: unresolved name: bar
28
+ }
29
+ }
30
+
31
+ mod m1 {
32
+ fn foo ( ) { }
33
+ }
34
+ use m1:: * ;
35
+
36
+ fn main ( ) {
37
+ foo ( ) ; //~ ERROR: unresolved name: foo
38
+ }
39
+
You can’t perform that action at this time.
0 commit comments