Address comments
This commit is contained in:
parent
b69d51162b
commit
84f1bc8b66
4 changed files with 10 additions and 9 deletions
|
@ -1434,9 +1434,12 @@ pub mod __internal {
|
|||
CURRENT_SESS.with(|p| {
|
||||
let _reset = Reset { prev: p.get() };
|
||||
|
||||
// No way to determine def location for a proc macro rigth now, so use call location.
|
||||
// No way to determine def location for a proc macro right now, so use call location.
|
||||
let location = cx.current_expansion.mark.expn_info().unwrap().call_site;
|
||||
// Opaque mark was already created by expansion, now create its transparent twin.
|
||||
// We can't use the call-site span literally here, even if it appears to provide
|
||||
// correct name resolution, because it has all the `ExpnInfo` wrong, so the edition
|
||||
// checks, lint macro checks, macro backtraces will all break.
|
||||
let opaque_mark = cx.current_expansion.mark;
|
||||
let transparent_mark = Mark::fresh_cloned(opaque_mark);
|
||||
transparent_mark.set_transparency(Transparency::Transparent);
|
||||
|
|
|
@ -2005,10 +2005,9 @@ impl<'a> Resolver<'a> {
|
|||
}
|
||||
}
|
||||
// Then find the last legacy mark from the end if it exists.
|
||||
while let Some(&mark) = iter.peek() {
|
||||
for mark in iter {
|
||||
if mark.transparency() == Transparency::SemiTransparent {
|
||||
result = Some(mark);
|
||||
iter.next();
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -57,7 +57,6 @@ struct MarkData {
|
|||
pub enum Transparency {
|
||||
/// Identifier produced by a transparent expansion is always resolved at call-site.
|
||||
/// Call-site spans in procedural macros, hygiene opt-out in `macro` should use this.
|
||||
/// (Not used yet.)
|
||||
Transparent,
|
||||
/// Identifier produced by a semi-transparent expansion may be resolved
|
||||
/// either at call-site or at definition-site.
|
||||
|
|
|
@ -68,11 +68,11 @@ impl Ident {
|
|||
Ident::new(self.name, self.span.modern())
|
||||
}
|
||||
|
||||
// "Normalize" ident for use in comparisons using "local variable hygiene".
|
||||
// Identifiers with same string value become same if they came from the same non-transparent
|
||||
// macro (e.g. `macro` or `macro_rules!` items) and stay different if they came from different
|
||||
// non-transparent macros.
|
||||
// Technically, this operation strips all transparent marks from ident's syntactic context.
|
||||
/// "Normalize" ident for use in comparisons using "local variable hygiene".
|
||||
/// Identifiers with same string value become same if they came from the same non-transparent
|
||||
/// macro (e.g. `macro` or `macro_rules!` items) and stay different if they came from different
|
||||
/// non-transparent macros.
|
||||
/// Technically, this operation strips all transparent marks from ident's syntactic context.
|
||||
pub fn modern_and_legacy(self) -> Ident {
|
||||
Ident::new(self.name, self.span.modern_and_legacy())
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue