syntax: Introduce Ident::can_be_raw
This commit is contained in:
parent
5cb5083909
commit
6ad55b3dec
10 changed files with 33 additions and 36 deletions
|
@ -340,12 +340,8 @@ impl Ident {
|
|||
if !Self::is_valid(string) {
|
||||
panic!("`{:?}` is not a valid identifier", string)
|
||||
}
|
||||
if is_raw {
|
||||
let normalized_sym = Symbol::intern(string);
|
||||
if normalized_sym == keywords::Underscore.name() ||
|
||||
ast::Ident::with_empty_ctxt(normalized_sym).is_path_segment_keyword() {
|
||||
panic!("`{:?}` is not a valid raw identifier", string)
|
||||
}
|
||||
if is_raw && !ast::Ident::from_str(string).can_be_raw() {
|
||||
panic!("`{}` cannot be a raw identifier", string);
|
||||
}
|
||||
Ident { sym, is_raw, span }
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue