-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
"exceeding_bitshifts" lint does not work in associated consts #69021
Comments
I'd like to take this. @rustbot claim |
Unify and improve const-prop lints Add a single helper method for all lints emitted by const-prop, and make that lint different from the CTFE `const_err` lint. Also consistently check overflow on *arithmetic*, not on the assertion, to make behavior the same for debug and release builds. See [this summary comment](rust-lang#69185 (comment)) for details and the latest status. In terms of lint formatting, I went for what seems to be the better style: have a general message above the code, and then a specific message at the span: ``` error: this arithmetic operation will overflow --> $DIR/const-err2.rs:21:18 | LL | let a_i128 = -std::i128::MIN; | ^^^^^^^^^^^^^^^ attempt to negate with overflow ``` We could also just have the specific message above and no text at the span if that is preferred. I also converted some of the existing tests to use compiletest revisions, so that the same test can check a bunch of different compile flags. Fixes rust-lang#69020. Helps with rust-lang#69021: debug/release are now consistent, but the assoc-const test in that issue still fails (there is a FIXME in the PR for this). The reason seems to be that const-prop notices the assoc const in `T::N << 42` and does not even bother calling `const_prop` on that operation. Has no effect on rust-lang#61821; the duplication there has entirely different reasons.
All right, #69185 landed, so what I planned here is done. The remaining issue is about associated consts. The issue there is that The issue is all yours, @jumbatm :) |
Great! I'll start investigating. |
|
- Change to warnings so that all lints are emitted - Expect build-pass - Change placeholder FIXME to WARN.
…op, r=RalfJung Don't bail out before linting in generic contexts. Fixes rust-lang#69021. cc rust-lang#70017 r? @RalfJung
- Change to warnings so that all lints are emitted - Expect build-pass - Change placeholder FIXME to WARN.
…op, r=RalfJung Don't bail out before linting in generic contexts. Fixes rust-lang#69021. cc rust-lang#70017 r? @RalfJung
The
exceeding_bitshifts
lint should fire on the following code, but it does not:Playground
(This testcase now exists in-tree as a FIXME in
ui/lint/lint-exceeding-bitshifts.rs
.)Cc @oli-obk @wesleywiser
This issue has been assigned to @jumbatm via this comment.
The text was updated successfully, but these errors were encountered: