File tree 4 files changed +10
-9
lines changed
4 files changed +10
-9
lines changed Original file line number Diff line number Diff line change @@ -1434,9 +1434,12 @@ pub mod __internal {
1434
1434
CURRENT_SESS . with ( |p| {
1435
1435
let _reset = Reset { prev : p. get ( ) } ;
1436
1436
1437
- // No way to determine def location for a proc macro rigth now, so use call location.
1437
+ // No way to determine def location for a proc macro right now, so use call location.
1438
1438
let location = cx. current_expansion . mark . expn_info ( ) . unwrap ( ) . call_site ;
1439
1439
// Opaque mark was already created by expansion, now create its transparent twin.
1440
+ // We can't use the call-site span literally here, even if it appears to provide
1441
+ // correct name resolution, because it has all the `ExpnInfo` wrong, so the edition
1442
+ // checks, lint macro checks, macro backtraces will all break.
1440
1443
let opaque_mark = cx. current_expansion . mark ;
1441
1444
let transparent_mark = Mark :: fresh_cloned ( opaque_mark) ;
1442
1445
transparent_mark. set_transparency ( Transparency :: Transparent ) ;
Original file line number Diff line number Diff line change @@ -2005,10 +2005,9 @@ impl<'a> Resolver<'a> {
2005
2005
}
2006
2006
}
2007
2007
// Then find the last legacy mark from the end if it exists.
2008
- while let Some ( & mark) = iter. peek ( ) {
2008
+ for mark in iter {
2009
2009
if mark. transparency ( ) == Transparency :: SemiTransparent {
2010
2010
result = Some ( mark) ;
2011
- iter. next ( ) ;
2012
2011
} else {
2013
2012
break ;
2014
2013
}
Original file line number Diff line number Diff line change @@ -57,7 +57,6 @@ struct MarkData {
57
57
pub enum Transparency {
58
58
/// Identifier produced by a transparent expansion is always resolved at call-site.
59
59
/// Call-site spans in procedural macros, hygiene opt-out in `macro` should use this.
60
- /// (Not used yet.)
61
60
Transparent ,
62
61
/// Identifier produced by a semi-transparent expansion may be resolved
63
62
/// either at call-site or at definition-site.
Original file line number Diff line number Diff line change @@ -68,11 +68,11 @@ impl Ident {
68
68
Ident :: new ( self . name , self . span . modern ( ) )
69
69
}
70
70
71
- // "Normalize" ident for use in comparisons using "local variable hygiene".
72
- // Identifiers with same string value become same if they came from the same non-transparent
73
- // macro (e.g. `macro` or `macro_rules!` items) and stay different if they came from different
74
- // non-transparent macros.
75
- // Technically, this operation strips all transparent marks from ident's syntactic context.
71
+ /// "Normalize" ident for use in comparisons using "local variable hygiene".
72
+ /// Identifiers with same string value become same if they came from the same non-transparent
73
+ /// macro (e.g. `macro` or `macro_rules!` items) and stay different if they came from different
74
+ /// non-transparent macros.
75
+ /// Technically, this operation strips all transparent marks from ident's syntactic context.
76
76
pub fn modern_and_legacy ( self ) -> Ident {
77
77
Ident :: new ( self . name , self . span . modern_and_legacy ( ) )
78
78
}
You can’t perform that action at this time.
0 commit comments