Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 1b068a0

Browse files
committedJan 13, 2025
Make sure to mark IMPL_TRAIT_REDUNDANT_CAPTURES as Allow in edition 2024
1 parent eb54a50 commit 1b068a0

File tree

3 files changed

+16
-12
lines changed

3 files changed

+16
-12
lines changed
 

‎compiler/rustc_lint/src/impl_trait_overcaptures.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ declare_lint! {
9999
/// To fix this, remove the `use<'a>`, since the lifetime is already captured
100100
/// since it is in scope.
101101
pub IMPL_TRAIT_REDUNDANT_CAPTURES,
102-
Warn,
102+
Allow,
103103
"redundant precise-capturing `use<...>` syntax on an `impl Trait`",
104104
}
105105

Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
11
//@ edition: 2024
2-
//@ check-pass
32

43
#![feature(precise_capturing_in_traits)]
4+
#![deny(impl_trait_redundant_captures)]
55

66
fn hello<'a>() -> impl Sized + use<'a> {}
7-
//~^ WARN all possible in-scope parameters are already captured
7+
//~^ ERROR all possible in-scope parameters are already captured
88

99
struct Inherent;
1010
impl Inherent {
1111
fn inherent(&self) -> impl Sized + use<'_> {}
12-
//~^ WARN all possible in-scope parameters are already captured
12+
//~^ ERROR all possible in-scope parameters are already captured
1313
}
1414

1515
trait Test<'a> {
1616
fn in_trait() -> impl Sized + use<'a, Self>;
17-
//~^ WARN all possible in-scope parameters are already captured
17+
//~^ ERROR all possible in-scope parameters are already captured
1818
}
1919
impl<'a> Test<'a> for () {
2020
fn in_trait() -> impl Sized + use<'a> {}
21-
//~^ WARN all possible in-scope parameters are already captured
21+
//~^ ERROR all possible in-scope parameters are already captured
2222
}
2323

2424
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,40 @@
1-
warning: all possible in-scope parameters are already captured, so `use<...>` syntax is redundant
1+
error: all possible in-scope parameters are already captured, so `use<...>` syntax is redundant
22
--> $DIR/redundant.rs:6:19
33
|
44
LL | fn hello<'a>() -> impl Sized + use<'a> {}
55
| ^^^^^^^^^^^^^-------
66
| |
77
| help: remove the `use<...>` syntax
88
|
9-
= note: `#[warn(impl_trait_redundant_captures)]` on by default
9+
note: the lint level is defined here
10+
--> $DIR/redundant.rs:4:9
11+
|
12+
LL | #![deny(impl_trait_redundant_captures)]
13+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1014

11-
warning: all possible in-scope parameters are already captured, so `use<...>` syntax is redundant
15+
error: all possible in-scope parameters are already captured, so `use<...>` syntax is redundant
1216
--> $DIR/redundant.rs:11:27
1317
|
1418
LL | fn inherent(&self) -> impl Sized + use<'_> {}
1519
| ^^^^^^^^^^^^^-------
1620
| |
1721
| help: remove the `use<...>` syntax
1822

19-
warning: all possible in-scope parameters are already captured, so `use<...>` syntax is redundant
23+
error: all possible in-scope parameters are already captured, so `use<...>` syntax is redundant
2024
--> $DIR/redundant.rs:16:22
2125
|
2226
LL | fn in_trait() -> impl Sized + use<'a, Self>;
2327
| ^^^^^^^^^^^^^-------------
2428
| |
2529
| help: remove the `use<...>` syntax
2630

27-
warning: all possible in-scope parameters are already captured, so `use<...>` syntax is redundant
31+
error: all possible in-scope parameters are already captured, so `use<...>` syntax is redundant
2832
--> $DIR/redundant.rs:20:22
2933
|
3034
LL | fn in_trait() -> impl Sized + use<'a> {}
3135
| ^^^^^^^^^^^^^-------
3236
| |
3337
| help: remove the `use<...>` syntax
3438

35-
warning: 4 warnings emitted
39+
error: aborting due to 4 previous errors
3640

0 commit comments

Comments
 (0)
Failed to load comments.