@@ -104,7 +104,7 @@ level is capped via cap-lints.
104104## deny
105105
106106A 'deny' lint produces an error if you violate it. For example, this code
107- runs into the ` exceeding_bitshifts ` lint.
107+ runs into the ` arithmetic_overflow ` lint.
108108
109109``` rust,no_run
110110fn main() {
@@ -114,13 +114,13 @@ fn main() {
114114
115115``` bash
116116$ rustc main.rs
117- error: bitshift exceeds the type ' s number of bits
118- --> main.rs:2:13
117+ error: this arithmetic operation will overflow
118+ --> main.rs:2:5
119119 |
1201202 | 100u8 << 10 ;
121- | ^^^^^^^^^^^
121+ | ^^^^^^^^^^^ attempt to shift left by ` 10_i32 ` , which would overflow
122122 |
123- = note: `#[deny(exceeding_bitshifts )]` on by default
123+ = note: ` # [deny(arithmetic_overflow )]` on by default
124124` ` `
125125
126126What' s the difference between an error from a lint and a regular old error?
@@ -306,19 +306,13 @@ And we compile it, capping lints to warn:
306306
307307```bash
308308$ rustc lib.rs --cap-lints warn
309- warning: bitshift exceeds the type ' s number of bits
309+ warning: this arithmetic operation will overflow
310310 --> lib.rs:2:5
311311 |
3123122 | 100u8 << 10;
313- | ^^^^^^^^^^^
313+ | ^^^^^^^^^^^ attempt to shift left by `10_i32`, which would overflow
314314 |
315- = note: ` # [warn(exceeding_bitshifts)]` on by default
316-
317- warning: this expression will panic at run-time
318- --> lib.rs:2:5
319- |
320- 2 | 100u8 << 10;
321- | ^^^^^^^^^^^ attempt to shift left with overflow
315+ = note: `#[warn(arithmetic_overflow)]` on by default
322316```
323317
324318It now only warns, rather than errors. We can go further and allow all lints:
0 commit comments