-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Warn or Error on errors in constants? #49791
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
Comments
@oli-obk do we have some idea of the fallout here? |
Crater didn't find anything on the miri PR. But an old version of winapi is affected. Old versions of other things might be affected, too. Or more windows things. Both are untested on crater |
This has been "fixed" on beta and nightly (there's no more error), but now there's also no more warning. I'm readding the warning by reintroducing the lint pass that visits all constants and type aliases pub type Foo = [u8; 0 - 1]; // no warning on beta/nihgtly |
Warn on all erroneous constants fixes #49791 fixes #47054 @Zoxc this PR triggers the nondeterministic errors of #49950 (comment) really often (at least on stage1).
This still needs a backport to beta. |
Backported to beta. |
Before the miri merger, you were allowed to write
pub const FOO: usize = 0 - 1;
(producing just a warning), but using it either in this crate or another produced an error.Since the miri merger, these kinds of constants have become hard errors (just like within statics).
This is of course a breaking change. So we need to decide whether to move back to the warning, or break this now. The warnings have existed for a very long time, but were never moved to
deny-by-default
cc @rust-lang/lang
related: #47054
The text was updated successfully, but these errors were encountered: