(&Shebang(a), &Shebang(b)) => a == b,
(&Lifetime(a), &Lifetime(b)) => a.name == b.name,
- (&Ident(a, b), &Ident(c, d)) => a.name == c.name && b == d,
+ (&Ident(a, b), &Ident(c, d)) => b == d && (a.name == c.name ||
+ a.name == keywords::DollarCrate.name() ||
+ c.name == keywords::DollarCrate.name()),
(&Literal(ref a, b), &Literal(ref c, d)) => {
b == d && a.probably_equal_for_proc_macro(c)
| TokenTree::Token(_, Token::Semi)
// The pretty printer collapses whitespace arbitrarily and can
// introduce whitespace from `NoDelim`.
- | TokenTree::Token(_, Token::Whitespace) => false,
+ | TokenTree::Token(_, Token::Whitespace)
+ // The pretty printer can turn `$crate` into `::crate_name`
+ | TokenTree::Token(_, Token::ModSep) => false,
_ => true
}
}
--> $DIR/dollar-crate.rs:23:13
|
LL | struct D($crate::S); //~ ERROR the name `D` is defined multiple times
- | ^^^^^^^^^^^^^^^^^^^^ `D` redefined here
+ | ^^^^^^^^^^^^^^^^^^^^
+ | |
+ | `D` redefined here
+ | previous definition of the type `D` here
...
LL | local!();
| --------- in this macro invocation
--> $DIR/dollar-crate.rs:31:5
|
LL | dollar_crate_external::external!(); //~ ERROR the name `D` is defined multiple times
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `D` redefined here
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | |
+ | `D` redefined here
+ | previous definition of the type `D` here
|
= note: `D` must be defined only once in the type namespace of this module
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
ATTRIBUTE INPUT: TokenStream [
Ident {
ident: "struct",
- span: #0 bytes(0..0)
+ span: #2 bytes(LO..HI)
},
Ident {
ident: "A",
- span: #0 bytes(0..0)
+ span: #2 bytes(LO..HI)
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
- ident: "crate",
- span: #0 bytes(0..0)
+ ident: "$crate",
+ span: #2 bytes(LO..HI)
},
Punct {
ch: ':',
spacing: Joint,
- span: #0 bytes(0..0)
+ span: #2 bytes(LO..HI)
},
Punct {
ch: ':',
spacing: Alone,
- span: #0 bytes(0..0)
+ span: #2 bytes(LO..HI)
},
Ident {
ident: "S",
- span: #0 bytes(0..0)
+ span: #2 bytes(LO..HI)
}
],
- span: #0 bytes(0..0)
+ span: #2 bytes(LO..HI)
},
Punct {
ch: ';',
spacing: Alone,
- span: #0 bytes(0..0)
+ span: #2 bytes(LO..HI)
}
]
DERIVE INPUT (PRETTY-PRINTED): struct D(crate::S);
DERIVE INPUT: TokenStream [
Ident {
ident: "struct",
- span: #0 bytes(0..0)
+ span: #2 bytes(LO..HI)
},
Ident {
ident: "D",
- span: #0 bytes(0..0)
+ span: #2 bytes(LO..HI)
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
- ident: "crate",
- span: #0 bytes(0..0)
+ ident: "$crate",
+ span: #2 bytes(LO..HI)
},
Punct {
ch: ':',
spacing: Joint,
- span: #0 bytes(0..0)
+ span: #2 bytes(LO..HI)
},
Punct {
ch: ':',
spacing: Alone,
- span: #0 bytes(0..0)
+ span: #2 bytes(LO..HI)
},
Ident {
ident: "S",
- span: #0 bytes(0..0)
+ span: #2 bytes(LO..HI)
}
],
- span: #0 bytes(0..0)
+ span: #2 bytes(LO..HI)
},
Punct {
ch: ';',
spacing: Alone,
- span: #0 bytes(0..0)
+ span: #2 bytes(LO..HI)
}
]
PROC MACRO INPUT (PRETTY-PRINTED): struct M ( $crate :: S ) ;
ATTRIBUTE INPUT: TokenStream [
Ident {
ident: "struct",
- span: #0 bytes(0..0)
+ span: #10 bytes(LO..HI)
},
Ident {
ident: "A",
- span: #0 bytes(0..0)
+ span: #10 bytes(LO..HI)
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
- Punct {
- ch: ':',
- spacing: Joint,
- span: #0 bytes(0..0)
- },
- Punct {
- ch: ':',
- spacing: Alone,
- span: #0 bytes(0..0)
- },
Ident {
- ident: "dollar_crate_external",
- span: #0 bytes(0..0)
+ ident: "$crate",
+ span: #10 bytes(LO..HI)
},
Punct {
ch: ':',
spacing: Joint,
- span: #0 bytes(0..0)
+ span: #10 bytes(LO..HI)
},
Punct {
ch: ':',
spacing: Alone,
- span: #0 bytes(0..0)
+ span: #10 bytes(LO..HI)
},
Ident {
ident: "S",
- span: #0 bytes(0..0)
+ span: #10 bytes(LO..HI)
}
],
- span: #0 bytes(0..0)
+ span: #10 bytes(LO..HI)
},
Punct {
ch: ';',
spacing: Alone,
- span: #0 bytes(0..0)
+ span: #10 bytes(LO..HI)
}
]
DERIVE INPUT (PRETTY-PRINTED): struct D(::dollar_crate_external::S);
DERIVE INPUT: TokenStream [
Ident {
ident: "struct",
- span: #0 bytes(0..0)
+ span: #10 bytes(LO..HI)
},
Ident {
ident: "D",
- span: #0 bytes(0..0)
+ span: #10 bytes(LO..HI)
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
- Punct {
- ch: ':',
- spacing: Joint,
- span: #0 bytes(0..0)
- },
- Punct {
- ch: ':',
- spacing: Alone,
- span: #0 bytes(0..0)
- },
Ident {
- ident: "dollar_crate_external",
- span: #0 bytes(0..0)
+ ident: "$crate",
+ span: #10 bytes(LO..HI)
},
Punct {
ch: ':',
spacing: Joint,
- span: #0 bytes(0..0)
+ span: #10 bytes(LO..HI)
},
Punct {
ch: ':',
spacing: Alone,
- span: #0 bytes(0..0)
+ span: #10 bytes(LO..HI)
},
Ident {
ident: "S",
- span: #0 bytes(0..0)
+ span: #10 bytes(LO..HI)
}
],
- span: #0 bytes(0..0)
+ span: #10 bytes(LO..HI)
},
Punct {
ch: ';',
spacing: Alone,
- span: #0 bytes(0..0)
+ span: #10 bytes(LO..HI)
}
]