@@ -1851,9 +1851,16 @@ impl KeywordIdents {
18511851 TokenTree :: Token ( token, _) => {
18521852 if let Some ( ( ident, token:: IdentIsRaw :: No ) ) = token. ident ( ) {
18531853 if !prev_dollar {
1854- self . check_ident_token ( cx, UnderMacro ( true ) , ident) ;
1854+ self . check_ident_token ( cx, UnderMacro ( true ) , ident, "" ) ;
18551855 }
1856- } else if * token == TokenKind :: Dollar {
1856+ } else if let Some ( ( ident, token:: IdentIsRaw :: No ) ) = token. lifetime ( ) {
1857+ self . check_ident_token (
1858+ cx,
1859+ UnderMacro ( true ) ,
1860+ ident. without_first_quote ( ) ,
1861+ "'" ,
1862+ ) ;
1863+ } else if token. kind == TokenKind :: Dollar {
18571864 prev_dollar = true ;
18581865 continue ;
18591866 }
@@ -1869,6 +1876,7 @@ impl KeywordIdents {
18691876 cx : & EarlyContext < ' _ > ,
18701877 UnderMacro ( under_macro) : UnderMacro ,
18711878 ident : Ident ,
1879+ prefix : & ' static str ,
18721880 ) {
18731881 let ( lint, edition) = match ident. name {
18741882 kw:: Async | kw:: Await | kw:: Try => ( KEYWORD_IDENTS_2018 , Edition :: Edition2018 ) ,
@@ -1902,7 +1910,7 @@ impl KeywordIdents {
19021910 cx. emit_span_lint (
19031911 lint,
19041912 ident. span ,
1905- BuiltinKeywordIdents { kw : ident, next : edition, suggestion : ident. span } ,
1913+ BuiltinKeywordIdents { kw : ident, next : edition, suggestion : ident. span , prefix } ,
19061914 ) ;
19071915 }
19081916}
@@ -1915,7 +1923,11 @@ impl EarlyLintPass for KeywordIdents {
19151923 self . check_tokens ( cx, & mac. args . tokens ) ;
19161924 }
19171925 fn check_ident ( & mut self , cx : & EarlyContext < ' _ > , ident : Ident ) {
1918- self . check_ident_token ( cx, UnderMacro ( false ) , ident) ;
1926+ if ident. name . as_str ( ) . starts_with ( '\'' ) {
1927+ self . check_ident_token ( cx, UnderMacro ( false ) , ident. without_first_quote ( ) , "'" ) ;
1928+ } else {
1929+ self . check_ident_token ( cx, UnderMacro ( false ) , ident, "" ) ;
1930+ }
19191931 }
19201932}
19211933
0 commit comments