Skip to content

Commit 1803886

Browse files
committed
review comments
1 parent 4f25c61 commit 1803886

File tree

2 files changed

+3
-11
lines changed

2 files changed

+3
-11
lines changed

src/librustc_resolve/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2893,7 +2893,7 @@ fn names_to_string(names: &[Name]) -> String {
28932893
if i > 0 {
28942894
result.push_str("::");
28952895
}
2896-
if name.is_used_keyword() && name.can_be_raw() {
2896+
if Ident::with_dummy_span(*name).is_raw_guess() {
28972897
result.push_str("r#");
28982898
}
28992899
result.push_str(&name.as_str());

src/libsyntax_pos/symbol.rs

+2-10
Original file line numberDiff line numberDiff line change
@@ -1013,15 +1013,7 @@ pub mod sym {
10131013
}
10141014

10151015
impl Symbol {
1016-
pub fn is_used_keyword(self) -> bool {
1017-
self.is_used_keyword_2015() || self.is_used_keyword_2018()
1018-
}
1019-
1020-
pub fn is_used_keyword_2015(self) -> bool {
1021-
self >= kw::As && self <= kw::While
1022-
}
1023-
1024-
pub fn is_used_keyword_2018(self) -> bool {
1016+
fn is_used_keyword_2018(self) -> bool {
10251017
self >= kw::Async && self <= kw::Dyn
10261018
}
10271019

@@ -1065,7 +1057,7 @@ impl Ident {
10651057
/// Returns `true` if the token is a keyword used in the language.
10661058
pub fn is_used_keyword(self) -> bool {
10671059
// Note: `span.edition()` is relatively expensive, don't call it unless necessary.
1068-
self.name.is_used_keyword_2015() ||
1060+
self.name >= kw::As && self.name <= kw::While ||
10691061
self.name.is_used_keyword_2018() && self.span.rust_2018()
10701062
}
10711063

0 commit comments

Comments
 (0)