We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
It's unintuitive that this doesn't compile:
struct Foo; const fn bar() -> Foo { Foo } // doesn't compile fn foo() -> &'static Foo { &bar() } // this compiles fn foo2() -> &'static Foo { const FOO: &'static Foo = &bar(); FOO } // this compiles fn foo3() -> &'static Foo { const FOO: Foo = bar(); &FOO }
https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=3b50f81085d7e51908ce0378ae865d0f
rustc should just generate a const (or static) behind the scenes and typecheck the code as if the user had written that.
const
static
The text was updated successfully, but these errors were encountered:
This is intended behavior according to rust-lang/const-eval#19
Sorry, something went wrong.
No branches or pull requests
It's unintuitive that this doesn't compile:
https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=3b50f81085d7e51908ce0378ae865d0f
rustc should just generate a
const
(orstatic
) behind the scenes and typecheck the code as if the user had written that.The text was updated successfully, but these errors were encountered: