rust/src/librustc_session
Mazdak Farrokhzad d237e0fc6c
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.
2020-02-20 20:18:50 +01:00
..
lint better lint names 2020-02-18 22:49:47 +01:00
Cargo.toml 1. move node_id to syntax 2020-02-01 18:58:08 +01:00
cgu_reuse_tracker.rs Rename syntax_pos to rustc_span in source code 2020-01-01 09:15:18 +03:00
code_stats.rs Format the world 2019-12-22 17:42:47 -05:00
config.rs Auto merge of #67885 - tobithiel:fix_group_lint_allow_override, r=Mark-Simulacrum 2020-02-16 15:28:41 +00:00
filesearch.rs Format the world 2019-12-22 17:42:47 -05:00
lib.rs 1. move node_id to syntax 2020-02-01 18:58:08 +01:00
lint.rs 1. move node_id to syntax 2020-02-01 18:58:08 +01:00
options.rs add selfprofiling for new llvm passmanager 2020-02-13 08:02:18 +01:00
parse.rs Make issue references consistent 2020-02-09 20:43:49 +01:00
search_paths.rs Add -Z no-link flag 2020-01-23 11:00:36 +11:00
session.rs Tune inlining 2020-02-19 16:03:21 +01:00
utils.rs Change -Z time event naming scheme and make them generic activities 2020-01-09 07:06:40 +01:00