Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rust: Attempt to lex constant idents (#741)
- Loading branch information
1 parent
87869f8
commit 55b0e59
Showing
3 changed files
with
87 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
const IM_A_CONST: () = (); | ||
|
||
fn main() { | ||
dbg!(IM_A_CONST); | ||
} | ||
|
||
// None of this should be considered const | ||
fn foo<T0, T1, U>(_: (T0, T1, U)) { | ||
let _: std::collections::BTreeSet<()> = todo!(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
[ | ||
{"type":"Keyword","value":"const"}, | ||
{"type":"TextWhitespace","value":" "}, | ||
{"type":"NameConstant","value":"IM_A_CONST"}, | ||
{"type":"Text","value":": "}, | ||
{"type":"Punctuation","value":"()"}, | ||
{"type":"TextWhitespace","value":" "}, | ||
{"type":"Operator","value":"="}, | ||
{"type":"TextWhitespace","value":" "}, | ||
{"type":"Punctuation","value":"();"}, | ||
{"type":"TextWhitespace","value":"\n\n"}, | ||
{"type":"Keyword","value":"fn"}, | ||
{"type":"Text","value":" "}, | ||
{"type":"NameFunction","value":"main"}, | ||
{"type":"Punctuation","value":"()"}, | ||
{"type":"TextWhitespace","value":" "}, | ||
{"type":"Punctuation","value":"{"}, | ||
{"type":"TextWhitespace","value":"\n "}, | ||
{"type":"NameFunctionMagic","value":"dbg!"}, | ||
{"type":"Punctuation","value":"("}, | ||
{"type":"NameConstant","value":"IM_A_CONST"}, | ||
{"type":"Punctuation","value":");"}, | ||
{"type":"TextWhitespace","value":"\n"}, | ||
{"type":"Punctuation","value":"}"}, | ||
{"type":"TextWhitespace","value":"\n\n"}, | ||
{"type":"CommentSingle","value":"// None of this should be considered const\n"}, | ||
{"type":"Keyword","value":"fn"}, | ||
{"type":"Text","value":" "}, | ||
{"type":"NameFunction","value":"foo"}, | ||
{"type":"Operator","value":"\u003c"}, | ||
{"type":"Name","value":"T0"}, | ||
{"type":"Punctuation","value":","}, | ||
{"type":"TextWhitespace","value":" "}, | ||
{"type":"Name","value":"T1"}, | ||
{"type":"Punctuation","value":","}, | ||
{"type":"TextWhitespace","value":" "}, | ||
{"type":"Name","value":"U"}, | ||
{"type":"Operator","value":"\u003e"}, | ||
{"type":"Punctuation","value":"("}, | ||
{"type":"Name","value":"_"}, | ||
{"type":"Text","value":": "}, | ||
{"type":"Punctuation","value":"("}, | ||
{"type":"Name","value":"T0"}, | ||
{"type":"Punctuation","value":","}, | ||
{"type":"TextWhitespace","value":" "}, | ||
{"type":"Name","value":"T1"}, | ||
{"type":"Punctuation","value":","}, | ||
{"type":"TextWhitespace","value":" "}, | ||
{"type":"Name","value":"U"}, | ||
{"type":"Punctuation","value":"))"}, | ||
{"type":"TextWhitespace","value":" "}, | ||
{"type":"Punctuation","value":"{"}, | ||
{"type":"TextWhitespace","value":"\n "}, | ||
{"type":"KeywordDeclaration","value":"let"}, | ||
{"type":"TextWhitespace","value":" "}, | ||
{"type":"Name","value":"_"}, | ||
{"type":"Text","value":": "}, | ||
{"type":"NameClass","value":"std"}, | ||
{"type":"Text","value":"::"}, | ||
{"type":"Name","value":"collections"}, | ||
{"type":"Text","value":"::"}, | ||
{"type":"Name","value":"BTreeSet"}, | ||
{"type":"Operator","value":"\u003c"}, | ||
{"type":"Punctuation","value":"()"}, | ||
{"type":"Operator","value":"\u003e"}, | ||
{"type":"TextWhitespace","value":" "}, | ||
{"type":"Operator","value":"="}, | ||
{"type":"TextWhitespace","value":" "}, | ||
{"type":"NameFunctionMagic","value":"todo!"}, | ||
{"type":"Punctuation","value":"();"}, | ||
{"type":"TextWhitespace","value":"\n"}, | ||
{"type":"Punctuation","value":"}"}, | ||
{"type":"TextWhitespace","value":"\n"} | ||
] |