]> git.lizzy.rs Git - rust.git/commitdiff
Auto merge of #35894 - jseyfried:new_import_semantics, r=nrc
authorbors <bors@rust-lang.org>
Fri, 2 Sep 2016 02:03:27 +0000 (19:03 -0700)
committerGitHub <noreply@github.com>
Fri, 2 Sep 2016 02:03:27 +0000 (19:03 -0700)
Implement RFC 1560 behind `#![feature(item_like_imports)]`

This implements https://github.com/rust-lang/rfcs/pull/1560 (cc #35120) behind the `item_like_imports` feature gate.

The [RFC text](https://github.com/rust-lang/rfcs/blob/master/text/1560-name-resolution.md#changes-to-name-resolution-rules) describes the changes to name resolution enabled by `#![feature(item_like_imports)` in detail. To summarize,
 - Items and named imports shadow glob imports.
 - Multiple globs can import the same name if the name is unused or the imports are shadowed.
 - Multiple globs can import the same name if the imports are of the same item (following re-exports).
  - The visibility of such a name is the maximum visibility of the imports.
  - Equivalently, adding a glob import will never reduce the visibility of a name, nor will removing one increase it.
 - Non-prelude private imports can be used wherever we currently allow private items to be used.
  - Prelude-imported names are unaffected, i.e. they continue to be usable only in lexical scopes.
 - Globs import all visible names, not just public names.
  - Equivalently, glob importing from an ancestor module imports all of the ancestor's names, and glob importing from other modules is unchanged.

r? @nrc


Trivial merge