mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 04:19:13 +00:00
internal: Properly check the edition for edition dependent syntax kinds
This commit is contained in:
parent
2b86639018
commit
f90bdfc13d
23 changed files with 348 additions and 130 deletions
|
@ -117,7 +117,7 @@ pub fn name_ref(name_ref: &str) -> ast::NameRef {
|
|||
ast_from_text(&format!("fn f() {{ {raw_escape}{name_ref}; }}"))
|
||||
}
|
||||
fn raw_ident_esc(ident: &str) -> &'static str {
|
||||
if is_raw_identifier(ident) {
|
||||
if is_raw_identifier(ident, Edition::CURRENT) {
|
||||
"r#"
|
||||
} else {
|
||||
""
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
use crate::SyntaxKind;
|
||||
|
||||
pub fn is_raw_identifier(name: &str) -> bool {
|
||||
let is_keyword = SyntaxKind::from_keyword(name).is_some();
|
||||
pub fn is_raw_identifier(name: &str, edition: parser::Edition) -> bool {
|
||||
let is_keyword = SyntaxKind::from_keyword(name, edition).is_some();
|
||||
is_keyword && !matches!(name, "self" | "crate" | "super" | "Self")
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue