]> git.lizzy.rs Git - rust.git/commitdiff
Auto merge of #30866 - jseyfried:fix_shadowed_use_visibility, r=nrc
authorbors <bors@rust-lang.org>
Mon, 1 Feb 2016 04:52:12 +0000 (04:52 +0000)
committerbors <bors@rust-lang.org>
Mon, 1 Feb 2016 04:52:12 +0000 (04:52 +0000)
This reverts PR #30324, fixing bug #30159 in which a public a glob import makes public any preceding imports that share a name with an item in the module being glob imported from.

For example,
```rust
pub fn f() {}
pub mod foo {
    fn f() {}
}

mod bar {
    use f;
    use f as g;
    pub use foo::*; // This makes the first import public but does not affect the second import.
}
```

This is a [breaking-change].

src/librustc_resolve/resolve_imports.rs
src/test/compile-fail/shadowed-use-visibility.rs

index 07f6a0f9549906fd84eedf9aa0096f9619643103..50537a6b936e96b0e7948b8bbadd6631c261987c 100644 (file)
@@ -798,9 +798,6 @@ fn merge_import_resolution(&mut self,
                 dest_import_resolution.is_public = is_public;
                 self.add_export(module_, name, &dest_import_resolution);
             }
-        } else {
-            // FIXME #30159: This is required for backwards compatability.
-            dest_import_resolution.is_public |= is_public;
         }
 
         self.check_for_conflicts_between_imports_and_items(module_,
index bfc6a4ec9b85449dfe902959e13c2f605aed2649..1bf7f3933849de76ba2307357ba574ebc776b90c 100644 (file)
@@ -17,6 +17,10 @@ pub fn f() {}
 
 mod bar {
     use foo::bar::f as g; //~ ERROR unresolved import
+
+    use foo as f;
+    pub use foo::*;
 }
 
+use bar::f::f; //~ ERROR unresolved import
 fn main() {}