-
Notifications
You must be signed in to change notification settings - Fork 12.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implementation of RFC 2151, Raw Identifiers #48942
Changes from all commits
fad1648
7d5c29b
d2e7953
5c3d632
ce84a41
bfb94ac
57f9c4d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -200,7 +200,7 @@ pub fn parse( | |
let span = match trees.next() { | ||
Some(tokenstream::TokenTree::Token(span, token::Colon)) => match trees.next() { | ||
Some(tokenstream::TokenTree::Token(end_sp, ref tok)) => match tok.ident() { | ||
Some(kind) => { | ||
Some((kind, _)) => { | ||
let span = end_sp.with_lo(start_sp.lo()); | ||
result.push(TokenTree::MetaVarDecl(span, ident, kind)); | ||
continue; | ||
|
@@ -289,14 +289,14 @@ where | |
// `tree` is followed by an `ident`. This could be `$meta_var` or the `$crate` special | ||
// metavariable that names the crate of the invokation. | ||
Some(tokenstream::TokenTree::Token(ident_span, ref token)) if token.is_ident() => { | ||
let ident = token.ident().unwrap(); | ||
let (ident, _) = token.ident().unwrap(); | ||
let span = ident_span.with_lo(span.lo()); | ||
if ident.name == keywords::Crate.name() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm, I think this will accept There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you add a test case for this as well? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Currently |
||
let ident = ast::Ident { | ||
name: keywords::DollarCrate.name(), | ||
..ident | ||
}; | ||
TokenTree::Token(span, token::Ident(ident)) | ||
TokenTree::Token(span, token::Ident(ident, false)) | ||
} else { | ||
TokenTree::MetaVar(span, ident) | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as https://github.com/rust-lang/rust/pull/48942/files#r175613878
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed this in
from_ast_ident
, since it seems this is the best behavior in all these cases.