-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Closed
Labels
C-bugCategory: This is a bug.Category: This is a bug.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.
Description
Now that non-capturing closures can be coerced to function pointers, I really want to do things like this:
struct Foo {
a: fn(u32) -> u32
}
static FOO: Foo = Foo {
a: |x| x*2
};
but while it seems to work perfectly, it still returns this warning:
warning: constant evaluation error: unsupported constant expr. This will become a HARD ERROR in the future
--> src/main.rs:7:19
|
7 | static Foo: Foo = Foo {
| ___________________^
8 | | a: |x| x*2
9 | | };
| |_^
|
= note: #[warn(const_err)] on by default
Why would this become an hard error? Is this an error in the lint, or is there a problem in doing this?
Metadata
Metadata
Assignees
Labels
C-bugCategory: This is a bug.Category: This is a bug.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.