1
Fork 0

Fix lifetime on LocalInternedString::get function

This commit is contained in:
John Kåre Alsaker 2019-03-16 08:50:19 +01:00
parent befeeb7c08
commit 438f6b04c6
4 changed files with 20 additions and 11 deletions

View file

@ -336,11 +336,11 @@ impl Ident {
}
}
fn new(sym: Symbol, is_raw: bool, span: Span) -> Ident {
let string = sym.as_str().get();
if !Self::is_valid(string) {
let string = sym.as_str();
if !Self::is_valid(&string) {
panic!("`{:?}` is not a valid identifier", string)
}
if is_raw && !ast::Ident::from_str(string).can_be_raw() {
if is_raw && !ast::Ident::from_interned_str(sym.as_interned_str()).can_be_raw() {
panic!("`{}` cannot be a raw identifier", string);
}
Ident { sym, is_raw, span }