Skip to content

Commit fe1c458

Browse files
committed
doc: replace exceeding_bitshifts with arithmetic_overflow
* doc: replace `exceeding_bitshifts` with `arithmetic_overflow` * replace another mention of `exceeding_bitshifts`, which is the only one left Co-authored-by: Cheng-Han Chiang <chiangchenghan03@gmail.com>
1 parent a69a632 commit fe1c458

1 file changed

Lines changed: 8 additions & 14 deletions

File tree

src/doc/rustc/src/lints/levels.md

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ level is capped via cap-lints.
104104
## deny
105105

106106
A '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
110110
fn 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
|
120120
2 | 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
126126
What'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
|
312312
2 | 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
324318
It now only warns, rather than errors. We can go further and allow all lints:

0 commit comments

Comments
 (0)