Skip to content

Commit

Permalink
review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
estebank committed Nov 24, 2019
1 parent 4f25c61 commit 1803886
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/librustc_resolve/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2893,7 +2893,7 @@ fn names_to_string(names: &[Name]) -> String {
if i > 0 {
result.push_str("::");
}
if name.is_used_keyword() && name.can_be_raw() {
if Ident::with_dummy_span(*name).is_raw_guess() {
result.push_str("r#");
}
result.push_str(&name.as_str());
Expand Down
12 changes: 2 additions & 10 deletions src/libsyntax_pos/symbol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1013,15 +1013,7 @@ pub mod sym {
}

impl Symbol {
pub fn is_used_keyword(self) -> bool {
self.is_used_keyword_2015() || self.is_used_keyword_2018()
}

pub fn is_used_keyword_2015(self) -> bool {
self >= kw::As && self <= kw::While
}

pub fn is_used_keyword_2018(self) -> bool {
fn is_used_keyword_2018(self) -> bool {
self >= kw::Async && self <= kw::Dyn
}

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

Expand Down

0 comments on commit 1803886

Please sign in to comment.