-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
Delay gensym creation for "underscore items" (use foo as _
/const _
) until name resolution
#56392
Changes from all commits
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 |
---|---|---|
|
@@ -9,6 +9,5 @@ | |
// except according to those terms. | ||
|
||
const _: () = (); //~ ERROR is unstable | ||
static _: () = (); //~ ERROR is unstable | ||
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. I understand this wasn't in the RFC, but I see no reason not to support it. 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.
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. At least the motivation in rust-lang/rfcs#2526 does not apply to statics. |
||
|
||
fn main() {} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
// compile-flags: -Z parse-only | ||
|
||
static _: () = (); //~ ERROR expected identifier, found reserved identifier `_` |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
error: expected identifier, found reserved identifier `_` | ||
--> $DIR/underscore_static.rs:3:8 | ||
| | ||
LL | static _: () = (); //~ ERROR expected identifier, found reserved identifier `_` | ||
| ^ expected identifier, found reserved identifier | ||
|
||
error: aborting due to previous error | ||
|
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.
Is this even a hypothetical problem for
_
?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'm... not entirely sure.
I haven't found an example where it would caused observable problems so far (assuming gensym creation is delayed until name resolution).
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.
#56303 (comment) has an example of gensyms being created incorrectly internally, but it's not observable from the outside.