diff options
| author | bors <bors@rust-lang.org> | 2019-02-10 12:47:16 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2019-02-10 12:47:16 +0000 |
| commit | af43950143b1672efd9fd5681d3fb52d0108f716 (patch) | |
| tree | 6d646f5fdb3e6d92bcab9d547329a0efc0afc095 /tests/mir-opt/lower_array_len.array_len_raw.NormalizeArrayLen.diff | |
| parent | 83edb647f22a6aa508565453eca79e032f3779dc (diff) | |
| parent | cb2d987ed4d4074e67ec307cbf5bfe289e876a3b (diff) | |
| download | rust-af43950143b1672efd9fd5681d3fb52d0108f716.tar.gz rust-af43950143b1672efd9fd5681d3fb52d0108f716.zip | |
Auto merge of #3740 - flip1995:const_assert_macro, r=oli-obk
Macro check for assertion_on_constants lint
The `assertion_on_constants` lint currently has following output for this code [Playground](https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=6f2c9df6fc50baf847212d3b5136ee97):
```rust
macro_rules! assert_const {
($len:expr) => {
assert!($len > 0);
}
}
fn main() {
assert_const!(3);
assert_const!(-1);
}
```
```
warning: assert!(const: true) will be optimized out by the compiler
--> src/main.rs:3:9
|
3 | assert!($len > 0);
| ^^^^^^^^^^^^^^^^^^
...
8 | assert_const!(3);
| ---------------- in this macro invocation
|
= note: #[warn(clippy::assertions_on_constants)] on by default
= help: remove it
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#assertions_on_constants
warning: assert!(const: false) should probably be replaced
--> src/main.rs:3:9
|
3 | assert!($len > 0);
| ^^^^^^^^^^^^^^^^^^
...
9 | assert_const!(-1);
| ----------------- in this macro invocation
|
= help: use panic!() or unreachable!()
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#assertions_on_constants
```
This is contradictory. This lint should not trigger if the `assert!` is in a macro itself.
Diffstat (limited to 'tests/mir-opt/lower_array_len.array_len_raw.NormalizeArrayLen.diff')
0 files changed, 0 insertions, 0 deletions
