resolve: Model resolve_legacy_scope after resolve_lexical_macro_path_segment
This commit is contained in:
parent
4e5e045459
commit
83a51deef5
6 changed files with 125 additions and 64 deletions
|
|
@ -17,14 +17,14 @@ macro_rules! macro_one { () => {} }
|
|||
#[macro_use(macro_two)] extern crate two_macros;
|
||||
|
||||
macro_rules! m1 { () => {
|
||||
macro_rules! foo { () => {} } //~ ERROR `foo` is already in scope
|
||||
macro_rules! foo { () => {} }
|
||||
|
||||
#[macro_use] //~ ERROR `macro_two` is already in scope
|
||||
extern crate two_macros as __;
|
||||
}}
|
||||
m1!();
|
||||
|
||||
foo!();
|
||||
foo!(); //~ ERROR `foo` is ambiguous
|
||||
|
||||
macro_rules! m2 { () => {
|
||||
macro_rules! foo { () => {} }
|
||||
|
|
|
|||
|
|
@ -9,16 +9,27 @@ LL | m1!();
|
|||
|
|
||||
= note: macro-expanded `#[macro_use]`s may not shadow existing macros (see RFC 1560)
|
||||
|
||||
error: `foo` is already in scope
|
||||
error[E0659]: `foo` is ambiguous
|
||||
--> $DIR/macro-shadowing.rs:27:1
|
||||
|
|
||||
LL | foo!(); //~ ERROR `foo` is ambiguous
|
||||
| ^^^
|
||||
|
|
||||
note: `foo` could refer to the name defined here
|
||||
--> $DIR/macro-shadowing.rs:20:5
|
||||
|
|
||||
LL | macro_rules! foo { () => {} } //~ ERROR `foo` is already in scope
|
||||
LL | macro_rules! foo { () => {} }
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
...
|
||||
LL | m1!();
|
||||
| ------ in this macro invocation
|
||||
note: `foo` could also refer to the name defined here
|
||||
--> $DIR/macro-shadowing.rs:15:1
|
||||
|
|
||||
= note: macro-expanded `macro_rules!`s may not shadow existing macros (see RFC 1560)
|
||||
LL | macro_rules! foo { () => {} }
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= note: macro-expanded macros do not shadow
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0659`.
|
||||
|
|
|
|||
|
|
@ -9,11 +9,10 @@
|
|||
// except according to those terms.
|
||||
|
||||
// aux-build:define_macro.rs
|
||||
// error-pattern: `bar` is already in scope
|
||||
|
||||
macro_rules! bar { () => {} }
|
||||
define_macro!(bar);
|
||||
bar!();
|
||||
bar!(); //~ ERROR `bar` is ambiguous
|
||||
|
||||
macro_rules! m { () => { #[macro_use] extern crate define_macro; } }
|
||||
m!();
|
||||
|
|
|
|||
|
|
@ -1,11 +1,22 @@
|
|||
error: `bar` is already in scope
|
||||
error[E0659]: `bar` is ambiguous
|
||||
--> $DIR/out-of-order-shadowing.rs:15:1
|
||||
|
|
||||
LL | bar!(); //~ ERROR `bar` is ambiguous
|
||||
| ^^^
|
||||
|
|
||||
note: `bar` could refer to the name defined here
|
||||
--> $DIR/out-of-order-shadowing.rs:14:1
|
||||
|
|
||||
LL | define_macro!(bar);
|
||||
| ^^^^^^^^^^^^^^^^^^^
|
||||
note: `bar` could also refer to the name defined here
|
||||
--> $DIR/out-of-order-shadowing.rs:13:1
|
||||
|
|
||||
= note: macro-expanded `macro_rules!`s may not shadow existing macros (see RFC 1560)
|
||||
LL | macro_rules! bar { () => {} }
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= note: macro-expanded macros do not shadow
|
||||
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0659`.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue