diff options
| author | Mazdak Farrokhzad <twingoow@gmail.com> | 2020-02-20 20:18:50 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-02-20 20:18:50 +0100 |
| commit | d237e0fc6c57b189e71fcbb66a332c7912da9eac (patch) | |
| tree | 4f101dcf923581344c4655a4284f63c858c187ea /src/libstd/sys/unix/stack_overflow.rs | |
| parent | b680a5e7c2aa9821287a699f3e60183086c42643 (diff) | |
| parent | 88d14bfbc986802601d2414ea5d6322e0056917b (diff) | |
| download | rust-d237e0fc6c57b189e71fcbb66a332c7912da9eac.tar.gz rust-d237e0fc6c57b189e71fcbb66a332c7912da9eac.zip | |
Rollup merge of #69185 - RalfJung:const-prop-lints, r=oli-obk
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](https://github.com/rust-lang/rust/pull/69185#issuecomment-587924754) 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 https://github.com/rust-lang/rust/issues/69020. Helps with https://github.com/rust-lang/rust/issues/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 https://github.com/rust-lang/rust/issues/61821; the duplication there has entirely different reasons.
Diffstat (limited to 'src/libstd/sys/unix/stack_overflow.rs')
0 files changed, 0 insertions, 0 deletions
