about summary refs log tree commit diff
path: root/src/libstd/sync
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2017-03-26 11:45:13 +0000
committerbors <bors@rust-lang.org>2017-03-26 11:45:13 +0000
commitbcfd5c48b7ec96cc28bef2cc5e29b4ae0ce6c3ac (patch)
treee67351baebb80578728a3ee602759f7ab05f52f0 /src/libstd/sync
parent7dd4e2db785c8ec360a989f69891b1e97dd4d369 (diff)
parentd64d3814c4a23fcb8440959bec77090fbbb25d7d (diff)
downloadrust-bcfd5c48b7ec96cc28bef2cc5e29b4ae0ce6c3ac.tar.gz
rust-bcfd5c48b7ec96cc28bef2cc5e29b4ae0ce6c3ac.zip
Auto merge of #40501 - jseyfried:shadow_builtin_macros, r=nrc
Allow `use` macro imports to shadow global macros

Terminology:
 - global scope: builtin macros, macros from the prelude, `#[macro_use]`, or `#![plugin(..)]`.
 - legacy scope: crate-local `macro_rules!`.
 - modern scope: `use` macro imports, `macro` (once implemented).

Today, the legacy scope can shadow the global scope (modulo RFC 1560 expanded shadowing restrictions). However, the modern scope cannot shadow or be shadowed by either the global or legacy scopes, leading to ambiguity errors.

This PR allows the modern scope to shadow the global scope (subject to some restrictions).
More specifically, a name in the global scope is as shadowable as a glob import in the module `self`. In other words, we imagine a special, implicit glob import in each module item:
```rust
mod foo {
    #[lexical_only] // Not accessible via `foo::<name>`, like pre-RFC 1560 `use` imports.
    #[shadowable_by_legacy_scope] // for back-compat
    use <global_macros>::*;
}
```

r? @nrc
Diffstat (limited to 'src/libstd/sync')
0 files changed, 0 insertions, 0 deletions