-
-
Notifications
You must be signed in to change notification settings - Fork 14.9k
Bad diagnostics when constructing tuple variant with static ref inside const #101363
Copy link
Copy link
Open
Labels
A-const-evalArea: Constant evaluation, covers all const contexts (static, const fn, ...)Area: Constant evaluation, covers all const contexts (static, const fn, ...)A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsE-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.Call for participation: An issue has been fixed and does not reproduce, but no test has been added.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Metadata
Metadata
Assignees
Labels
A-const-evalArea: Constant evaluation, covers all const contexts (static, const fn, ...)Area: Constant evaluation, covers all const contexts (static, const fn, ...)A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsE-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.Call for participation: An issue has been fixed and does not reproduce, but no test has been added.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Given the following code: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=faa286146f7760bc7c1be85eaac73f9d
The current output is (both on stable, beta, and nightly):
It is, however, possible to get this code to compile by using the struct initialiser syntax for the tuple variant:
Given that this initialiser isn't used very often, it took me a while to remember it as an alternative and to figure out that the use of
Someas a function was causing the error.Ideally, the error message should also suggest something like