File tree 3 files changed +41
-41
lines changed
doc/rustc/src/lints/listing
3 files changed +41
-41
lines changed Original file line number Diff line number Diff line change @@ -122,6 +122,46 @@ error: literal out of range for u8
122
122
|
123
123
```
124
124
125
+ ## patterns-in-fns-without-body
126
+
127
+ This lint detects patterns in functions without body were that were
128
+ previously erroneously allowed. Some example code that triggers this lint:
129
+
130
+ ``` rust,compile_fail
131
+ trait Trait {
132
+ fn foo(mut arg: u8);
133
+ }
134
+ ```
135
+
136
+ This will produce:
137
+
138
+ ``` text
139
+ warning: patterns aren't allowed in methods without bodies
140
+ --> src/main.rs:2:12
141
+ |
142
+ 2 | fn foo(mut arg: u8);
143
+ | ^^^^^^^
144
+ |
145
+ = note: `#[warn(patterns_in_fns_without_body)]` on by default
146
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
147
+ = note: for more information, see issue #35203 <https://github.com/rust-lang/rust/issues/35203>
148
+ ```
149
+
150
+ To fix this, remove the pattern; it can be used in the implementation without
151
+ being used in the definition. That is:
152
+
153
+ ``` rust
154
+ trait Trait {
155
+ fn foo (arg : u8 );
156
+ }
157
+
158
+ impl Trait for i32 {
159
+ fn foo (mut arg : u8 ) {
160
+
161
+ }
162
+ }
163
+ ```
164
+
125
165
## pub-use-of-private-extern-crate
126
166
127
167
This lint detects a specific situation of re-exporting a private ` extern crate ` ;
Original file line number Diff line number Diff line change @@ -307,46 +307,6 @@ warning: path statement with no effect
307
307
|
308
308
```
309
309
310
- ## patterns-in-fns-without-body
311
-
312
- This lint detects patterns in functions without body were that were
313
- previously erroneously allowed. Some example code that triggers this lint:
314
-
315
- ``` rust
316
- trait Trait {
317
- fn foo (mut arg : u8 );
318
- }
319
- ```
320
-
321
- This will produce:
322
-
323
- ``` text
324
- warning: patterns aren't allowed in methods without bodies
325
- --> src/main.rs:2:12
326
- |
327
- 2 | fn foo(mut arg: u8);
328
- | ^^^^^^^
329
- |
330
- = note: `#[warn(patterns_in_fns_without_body)]` on by default
331
- = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
332
- = note: for more information, see issue #35203 <https://github.com/rust-lang/rust/issues/35203>
333
- ```
334
-
335
- To fix this, remove the pattern; it can be used in the implementation without
336
- being used in the definition. That is:
337
-
338
- ``` rust
339
- trait Trait {
340
- fn foo (arg : u8 );
341
- }
342
-
343
- impl Trait for i32 {
344
- fn foo (mut arg : u8 ) {
345
-
346
- }
347
- }
348
- ```
349
-
350
310
## plugin-as-library
351
311
352
312
This lint detects when compiler plugins are used as ordinary library in
Original file line number Diff line number Diff line change @@ -189,7 +189,7 @@ declare_lint! {
189
189
190
190
declare_lint ! {
191
191
pub PATTERNS_IN_FNS_WITHOUT_BODY ,
192
- Warn ,
192
+ Deny ,
193
193
"patterns in functions without body were erroneously allowed" ,
194
194
@future_incompatible = FutureIncompatibleInfo {
195
195
reference: "issue #35203 <https://github.com/rust-lang/rust/issues/35203>" ,
You can’t perform that action at this time.
0 commit comments