@@ -1851,9 +1851,16 @@ impl KeywordIdents {
1851
1851
TokenTree :: Token ( token, _) => {
1852
1852
if let Some ( ( ident, token:: IdentIsRaw :: No ) ) = token. ident ( ) {
1853
1853
if !prev_dollar {
1854
- self . check_ident_token ( cx, UnderMacro ( true ) , ident) ;
1854
+ self . check_ident_token ( cx, UnderMacro ( true ) , ident, "" ) ;
1855
1855
}
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 {
1857
1864
prev_dollar = true ;
1858
1865
continue ;
1859
1866
}
@@ -1869,6 +1876,7 @@ impl KeywordIdents {
1869
1876
cx : & EarlyContext < ' _ > ,
1870
1877
UnderMacro ( under_macro) : UnderMacro ,
1871
1878
ident : Ident ,
1879
+ prefix : & ' static str ,
1872
1880
) {
1873
1881
let ( lint, edition) = match ident. name {
1874
1882
kw:: Async | kw:: Await | kw:: Try => ( KEYWORD_IDENTS_2018 , Edition :: Edition2018 ) ,
@@ -1902,7 +1910,7 @@ impl KeywordIdents {
1902
1910
cx. emit_span_lint (
1903
1911
lint,
1904
1912
ident. span ,
1905
- BuiltinKeywordIdents { kw : ident, next : edition, suggestion : ident. span } ,
1913
+ BuiltinKeywordIdents { kw : ident, next : edition, suggestion : ident. span , prefix } ,
1906
1914
) ;
1907
1915
}
1908
1916
}
@@ -1915,7 +1923,11 @@ impl EarlyLintPass for KeywordIdents {
1915
1923
self . check_tokens ( cx, & mac. args . tokens ) ;
1916
1924
}
1917
1925
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
+ }
1919
1931
}
1920
1932
}
1921
1933
0 commit comments