1
1
error: `impl Sized` will capture more lifetimes than possibly intended in edition 2024
2
- --> $DIR/overcaptures-2024.rs:6 :29
2
+ --> $DIR/overcaptures-2024.rs:7 :29
3
3
|
4
4
LL | fn named<'a>(x: &'a i32) -> impl Sized { *x }
5
5
| ^^^^^^^^^^
6
6
|
7
7
= warning: this changes meaning in Rust 2024
8
8
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/rpit-lifetime-capture.html>
9
9
note: specifically, this lifetime is in scope but not mentioned in the type's bounds
10
- --> $DIR/overcaptures-2024.rs:6 :10
10
+ --> $DIR/overcaptures-2024.rs:7 :10
11
11
|
12
12
LL | fn named<'a>(x: &'a i32) -> impl Sized { *x }
13
13
| ^^
14
14
= note: all lifetimes in scope will be captured by `impl Trait`s in edition 2024
15
15
note: the lint level is defined here
16
- --> $DIR/overcaptures-2024.rs:4 :9
16
+ --> $DIR/overcaptures-2024.rs:5 :9
17
17
|
18
18
LL | #![deny(impl_trait_overcaptures)]
19
19
| ^^^^^^^^^^^^^^^^^^^^^^^
@@ -23,15 +23,15 @@ LL | fn named<'a>(x: &'a i32) -> impl Sized + use<> { *x }
23
23
| +++++++
24
24
25
25
error: `impl Sized` will capture more lifetimes than possibly intended in edition 2024
26
- --> $DIR/overcaptures-2024.rs:10 :25
26
+ --> $DIR/overcaptures-2024.rs:11 :25
27
27
|
28
28
LL | fn implicit(x: &i32) -> impl Sized { *x }
29
29
| ^^^^^^^^^^
30
30
|
31
31
= warning: this changes meaning in Rust 2024
32
32
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/rpit-lifetime-capture.html>
33
33
note: specifically, this lifetime is in scope but not mentioned in the type's bounds
34
- --> $DIR/overcaptures-2024.rs:10 :16
34
+ --> $DIR/overcaptures-2024.rs:11 :16
35
35
|
36
36
LL | fn implicit(x: &i32) -> impl Sized { *x }
37
37
| ^
@@ -42,15 +42,15 @@ LL | fn implicit(x: &i32) -> impl Sized + use<> { *x }
42
42
| +++++++
43
43
44
44
error: `impl Sized + '_` will capture more lifetimes than possibly intended in edition 2024
45
- --> $DIR/overcaptures-2024.rs:16 :33
45
+ --> $DIR/overcaptures-2024.rs:17 :33
46
46
|
47
47
LL | fn hello(&self, x: &i32) -> impl Sized + '_ { self }
48
48
| ^^^^^^^^^^^^^^^
49
49
|
50
50
= warning: this changes meaning in Rust 2024
51
51
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/rpit-lifetime-capture.html>
52
52
note: specifically, this lifetime is in scope but not mentioned in the type's bounds
53
- --> $DIR/overcaptures-2024.rs:16 :24
53
+ --> $DIR/overcaptures-2024.rs:17 :24
54
54
|
55
55
LL | fn hello(&self, x: &i32) -> impl Sized + '_ { self }
56
56
| ^
@@ -61,15 +61,15 @@ LL | fn hello(&self, x: &i32) -> impl Sized + '_ + use<'_> { self }
61
61
| +++++++++
62
62
63
63
error: `impl Sized` will capture more lifetimes than possibly intended in edition 2024
64
- --> $DIR/overcaptures-2024.rs:28 :47
64
+ --> $DIR/overcaptures-2024.rs:29 :47
65
65
|
66
66
LL | fn hrtb() -> impl for<'a> Higher<'a, Output = impl Sized> {}
67
67
| ^^^^^^^^^^
68
68
|
69
69
= warning: this changes meaning in Rust 2024
70
70
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/rpit-lifetime-capture.html>
71
71
note: specifically, this lifetime is in scope but not mentioned in the type's bounds
72
- --> $DIR/overcaptures-2024.rs:28 :23
72
+ --> $DIR/overcaptures-2024.rs:29 :23
73
73
|
74
74
LL | fn hrtb() -> impl for<'a> Higher<'a, Output = impl Sized> {}
75
75
| ^^
@@ -80,21 +80,21 @@ LL | fn hrtb() -> impl for<'a> Higher<'a, Output = impl Sized + use<>> {}
80
80
| +++++++
81
81
82
82
error: `impl Sized` will capture more lifetimes than possibly intended in edition 2024
83
- --> $DIR/overcaptures-2024.rs:32 :28
83
+ --> $DIR/overcaptures-2024.rs:33 :28
84
84
|
85
85
LL | fn apit(_: &impl Sized) -> impl Sized {}
86
86
| ^^^^^^^^^^
87
87
|
88
88
= warning: this changes meaning in Rust 2024
89
89
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/rpit-lifetime-capture.html>
90
90
note: specifically, this lifetime is in scope but not mentioned in the type's bounds
91
- --> $DIR/overcaptures-2024.rs:32 :12
91
+ --> $DIR/overcaptures-2024.rs:33 :12
92
92
|
93
93
LL | fn apit(_: &impl Sized) -> impl Sized {}
94
94
| ^
95
95
= note: all lifetimes in scope will be captured by `impl Trait`s in edition 2024
96
96
note: you could use a `use<...>` bound to explicitly specify captures, but argument-position `impl Trait`s are not nameable
97
- --> $DIR/overcaptures-2024.rs:32 :13
97
+ --> $DIR/overcaptures-2024.rs:33 :13
98
98
|
99
99
LL | fn apit(_: &impl Sized) -> impl Sized {}
100
100
| ^^^^^^^^^^
@@ -104,21 +104,21 @@ LL | fn apit<T: Sized>(_: &T) -> impl Sized + use<T> {}
104
104
| ++++++++++ ~ ++++++++
105
105
106
106
error: `impl Sized` will capture more lifetimes than possibly intended in edition 2024
107
- --> $DIR/overcaptures-2024.rs:36 :38
107
+ --> $DIR/overcaptures-2024.rs:37 :38
108
108
|
109
109
LL | fn apit2<U>(_: &impl Sized, _: U) -> impl Sized {}
110
110
| ^^^^^^^^^^
111
111
|
112
112
= warning: this changes meaning in Rust 2024
113
113
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/rpit-lifetime-capture.html>
114
114
note: specifically, this lifetime is in scope but not mentioned in the type's bounds
115
- --> $DIR/overcaptures-2024.rs:36 :16
115
+ --> $DIR/overcaptures-2024.rs:37 :16
116
116
|
117
117
LL | fn apit2<U>(_: &impl Sized, _: U) -> impl Sized {}
118
118
| ^
119
119
= note: all lifetimes in scope will be captured by `impl Trait`s in edition 2024
120
120
note: you could use a `use<...>` bound to explicitly specify captures, but argument-position `impl Trait`s are not nameable
121
- --> $DIR/overcaptures-2024.rs:36 :17
121
+ --> $DIR/overcaptures-2024.rs:37 :17
122
122
|
123
123
LL | fn apit2<U>(_: &impl Sized, _: U) -> impl Sized {}
124
124
| ^^^^^^^^^^
@@ -127,5 +127,24 @@ help: use the precise capturing `use<...>` syntax to make the captures explicit
127
127
LL | fn apit2<U, T: Sized>(_: &T, _: U) -> impl Sized + use<U, T> {}
128
128
| ++++++++++ ~ +++++++++++
129
129
130
- error: aborting due to 6 previous errors
130
+ error: `impl Sized` will capture more lifetimes than possibly intended in edition 2024
131
+ --> $DIR/overcaptures-2024.rs:41:37
132
+ |
133
+ LL | async fn async_fn<'a>(x: &'a ()) -> impl Sized {}
134
+ | ^^^^^^^^^^
135
+ |
136
+ = warning: this changes meaning in Rust 2024
137
+ = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/rpit-lifetime-capture.html>
138
+ note: specifically, this lifetime is in scope but not mentioned in the type's bounds
139
+ --> $DIR/overcaptures-2024.rs:41:19
140
+ |
141
+ LL | async fn async_fn<'a>(x: &'a ()) -> impl Sized {}
142
+ | ^^
143
+ = note: all lifetimes in scope will be captured by `impl Trait`s in edition 2024
144
+ help: use the precise capturing `use<...>` syntax to make the captures explicit
145
+ |
146
+ LL | async fn async_fn<'a>(x: &'a ()) -> impl Sized + use<> {}
147
+ | +++++++
148
+
149
+ error: aborting due to 7 previous errors
131
150
0 commit comments