File tree Expand file tree Collapse file tree 4 files changed +10
-9
lines changed Expand file tree Collapse file tree 4 files changed +10
-9
lines changed Original file line number Diff line number Diff line change @@ -1434,9 +1434,12 @@ pub mod __internal {
14341434 CURRENT_SESS . with ( |p| {
14351435 let _reset = Reset { prev : p. get ( ) } ;
14361436
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.
14381438 let location = cx. current_expansion . mark . expn_info ( ) . unwrap ( ) . call_site ;
14391439 // 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.
14401443 let opaque_mark = cx. current_expansion . mark ;
14411444 let transparent_mark = Mark :: fresh_cloned ( opaque_mark) ;
14421445 transparent_mark. set_transparency ( Transparency :: Transparent ) ;
Original file line number Diff line number Diff line change @@ -2005,10 +2005,9 @@ impl<'a> Resolver<'a> {
20052005 }
20062006 }
20072007 // Then find the last legacy mark from the end if it exists.
2008- while let Some ( & mark) = iter. peek ( ) {
2008+ for mark in iter {
20092009 if mark. transparency ( ) == Transparency :: SemiTransparent {
20102010 result = Some ( mark) ;
2011- iter. next ( ) ;
20122011 } else {
20132012 break ;
20142013 }
Original file line number Diff line number Diff line change @@ -57,7 +57,6 @@ struct MarkData {
5757pub enum Transparency {
5858 /// Identifier produced by a transparent expansion is always resolved at call-site.
5959 /// Call-site spans in procedural macros, hygiene opt-out in `macro` should use this.
60- /// (Not used yet.)
6160 Transparent ,
6261 /// Identifier produced by a semi-transparent expansion may be resolved
6362 /// either at call-site or at definition-site.
Original file line number Diff line number Diff line change @@ -68,11 +68,11 @@ impl Ident {
6868 Ident :: new ( self . name , self . span . modern ( ) )
6969 }
7070
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.
7676 pub fn modern_and_legacy ( self ) -> Ident {
7777 Ident :: new ( self . name , self . span . modern_and_legacy ( ) )
7878 }
You can’t perform that action at this time.
0 commit comments