Reapply the macro_rules disambiguation changes from master
This commit is contained in:
parent
c29fb80c05
commit
0d8e9cd4df
3 changed files with 7 additions and 20 deletions
|
@ -2388,6 +2388,7 @@ name = "rustc_resolve"
|
||||||
version = "0.0.0"
|
version = "0.0.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"arena 0.0.0",
|
"arena 0.0.0",
|
||||||
|
"bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"log 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
"log 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"rustc 0.0.0",
|
"rustc 0.0.0",
|
||||||
"rustc_data_structures 0.0.0",
|
"rustc_data_structures 0.0.0",
|
||||||
|
|
|
@ -642,7 +642,7 @@ impl<'a, 'cl> Resolver<'a, 'cl> {
|
||||||
}
|
}
|
||||||
WhereToResolve::MacroRules(legacy_scope) => match legacy_scope {
|
WhereToResolve::MacroRules(legacy_scope) => match legacy_scope {
|
||||||
LegacyScope::Binding(legacy_binding) if ident == legacy_binding.ident =>
|
LegacyScope::Binding(legacy_binding) if ident == legacy_binding.ident =>
|
||||||
Ok((legacy_binding.binding, Flags::MACRO_RULES, Flags::MODULE)),
|
Ok((legacy_binding.binding, Flags::MACRO_RULES, Flags::empty())),
|
||||||
_ => Err(Determinacy::Determined),
|
_ => Err(Determinacy::Determined),
|
||||||
}
|
}
|
||||||
WhereToResolve::Module(module) => {
|
WhereToResolve::Module(module) => {
|
||||||
|
@ -804,7 +804,10 @@ impl<'a, 'cl> Resolver<'a, 'cl> {
|
||||||
(innermost_binding.is_glob_import() ||
|
(innermost_binding.is_glob_import() ||
|
||||||
innermost_binding.may_appear_after(parent_scope.expansion, binding) ||
|
innermost_binding.may_appear_after(parent_scope.expansion, binding) ||
|
||||||
innermost_flags.intersects(ambig_flags) ||
|
innermost_flags.intersects(ambig_flags) ||
|
||||||
flags.intersects(innermost_ambig_flags)) {
|
flags.intersects(innermost_ambig_flags) ||
|
||||||
|
(innermost_flags.contains(Flags::MACRO_RULES) &&
|
||||||
|
flags.contains(Flags::MODULE) &&
|
||||||
|
!self.disambiguate_legacy_vs_modern(innermost_binding, binding))) {
|
||||||
self.ambiguity_errors.push(AmbiguityError {
|
self.ambiguity_errors.push(AmbiguityError {
|
||||||
ident,
|
ident,
|
||||||
b1: innermost_binding,
|
b1: innermost_binding,
|
||||||
|
|
|
@ -34,23 +34,6 @@ LL | use two_macros::m;
|
||||||
| ^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^
|
||||||
= note: macro-expanded macro imports do not shadow
|
= note: macro-expanded macro imports do not shadow
|
||||||
|
|
||||||
error[E0659]: `m` is ambiguous
|
error: aborting due to 2 previous errors
|
||||||
--> $DIR/macros.rs:48:5
|
|
||||||
|
|
|
||||||
LL | m!(); //~ ERROR ambiguous
|
|
||||||
| ^ ambiguous name
|
|
||||||
|
|
|
||||||
note: `m` could refer to the name defined here
|
|
||||||
--> $DIR/macros.rs:46:5
|
|
||||||
|
|
|
||||||
LL | macro_rules! m { () => {} }
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
note: `m` could also refer to the name imported here
|
|
||||||
--> $DIR/macros.rs:47:9
|
|
||||||
|
|
|
||||||
LL | use two_macros::m;
|
|
||||||
| ^^^^^^^^^^^^^
|
|
||||||
|
|
||||||
error: aborting due to 3 previous errors
|
|
||||||
|
|
||||||
For more information about this error, try `rustc --explain E0659`.
|
For more information about this error, try `rustc --explain E0659`.
|
||||||
|
|
Loading…
Add table
Reference in a new issue