Skip to content

Commit 1c1d01e

Browse files
committed
More nll revisions
1 parent 72e3e0e commit 1c1d01e

File tree

54 files changed

+380
-223
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+380
-223
lines changed

src/test/ui/variance/variance-associated-types2.stderr renamed to src/test/ui/variance/variance-associated-types2.base.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
error[E0308]: mismatched types
2-
--> $DIR/variance-associated-types2.rs:13:42
2+
--> $DIR/variance-associated-types2.rs:17:42
33
|
44
LL | let _: Box<dyn Foo<Bar = &'a u32>> = make();
55
| ^^^^^^ lifetime mismatch
66
|
77
= note: expected trait object `dyn Foo<Bar = &'a u32>`
88
found trait object `dyn Foo<Bar = &'static u32>`
99
note: the lifetime `'a` as defined here...
10-
--> $DIR/variance-associated-types2.rs:12:9
10+
--> $DIR/variance-associated-types2.rs:16:9
1111
|
1212
LL | fn take<'a>(_: &'a u32) {
1313
| ^^

src/test/ui/variance/variance-associated-types2.nll.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: lifetime may not live long enough
2-
--> $DIR/variance-associated-types2.rs:13:12
2+
--> $DIR/variance-associated-types2.rs:17:12
33
|
44
LL | fn take<'a>(_: &'a u32) {
55
| -- lifetime `'a` defined here

src/test/ui/variance/variance-associated-types2.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
// Test that dyn Foo<Bar = T> is invariant with respect to T.
22
// Failure to enforce invariance here can be weaponized, see #71550 for details.
33

4+
// revisions: base nll
5+
// ignore-compare-mode-nll
6+
//[nll] compile-flags: -Z borrowck=mir
7+
48
trait Foo {
59
type Bar;
610
}
@@ -11,7 +15,8 @@ fn make() -> Box<dyn Foo<Bar = &'static u32>> {
1115

1216
fn take<'a>(_: &'a u32) {
1317
let _: Box<dyn Foo<Bar = &'a u32>> = make();
14-
//~^ ERROR mismatched types [E0308]
18+
//[base]~^ ERROR mismatched types [E0308]
19+
//[nll]~^^ ERROR lifetime may not live long enough
1520
}
1621

1722
fn main() {}

src/test/ui/variance/variance-btree-invariant-types.stderr renamed to src/test/ui/variance/variance-btree-invariant-types.base.stderr

+32-32
Original file line numberDiff line numberDiff line change
@@ -1,238 +1,238 @@
11
error[E0308]: mismatched types
2-
--> $DIR/variance-btree-invariant-types.rs:4:5
2+
--> $DIR/variance-btree-invariant-types.rs:8:5
33
|
44
LL | v
55
| ^ lifetime mismatch
66
|
77
= note: expected struct `std::collections::btree_map::IterMut<'_, &'new (), _>`
88
found struct `std::collections::btree_map::IterMut<'_, &'static (), _>`
99
note: the lifetime `'new` as defined here...
10-
--> $DIR/variance-btree-invariant-types.rs:3:21
10+
--> $DIR/variance-btree-invariant-types.rs:7:21
1111
|
1212
LL | fn iter_cov_key<'a, 'new>(v: IterMut<'a, &'static (), ()>) -> IterMut<'a, &'new (), ()> {
1313
| ^^^^
1414
= note: ...does not necessarily outlive the static lifetime
1515

1616
error[E0308]: mismatched types
17-
--> $DIR/variance-btree-invariant-types.rs:7:5
17+
--> $DIR/variance-btree-invariant-types.rs:13:5
1818
|
1919
LL | v
2020
| ^ lifetime mismatch
2121
|
2222
= note: expected struct `std::collections::btree_map::IterMut<'_, _, &'new ()>`
2323
found struct `std::collections::btree_map::IterMut<'_, _, &'static ()>`
2424
note: the lifetime `'new` as defined here...
25-
--> $DIR/variance-btree-invariant-types.rs:6:21
25+
--> $DIR/variance-btree-invariant-types.rs:12:21
2626
|
2727
LL | fn iter_cov_val<'a, 'new>(v: IterMut<'a, (), &'static ()>) -> IterMut<'a, (), &'new ()> {
2828
| ^^^^
2929
= note: ...does not necessarily outlive the static lifetime
3030

3131
error[E0308]: mismatched types
32-
--> $DIR/variance-btree-invariant-types.rs:10:5
32+
--> $DIR/variance-btree-invariant-types.rs:18:5
3333
|
3434
LL | v
3535
| ^ lifetime mismatch
3636
|
3737
= note: expected struct `std::collections::btree_map::IterMut<'_, &'static (), _>`
3838
found struct `std::collections::btree_map::IterMut<'_, &'new (), _>`
3939
note: the lifetime `'new` as defined here...
40-
--> $DIR/variance-btree-invariant-types.rs:9:24
40+
--> $DIR/variance-btree-invariant-types.rs:17:24
4141
|
4242
LL | fn iter_contra_key<'a, 'new>(v: IterMut<'a, &'new (), ()>) -> IterMut<'a, &'static (), ()> {
4343
| ^^^^
4444
= note: ...does not necessarily outlive the static lifetime
4545

4646
error[E0308]: mismatched types
47-
--> $DIR/variance-btree-invariant-types.rs:13:5
47+
--> $DIR/variance-btree-invariant-types.rs:23:5
4848
|
4949
LL | v
5050
| ^ lifetime mismatch
5151
|
5252
= note: expected struct `std::collections::btree_map::IterMut<'_, _, &'static ()>`
5353
found struct `std::collections::btree_map::IterMut<'_, _, &'new ()>`
5454
note: the lifetime `'new` as defined here...
55-
--> $DIR/variance-btree-invariant-types.rs:12:24
55+
--> $DIR/variance-btree-invariant-types.rs:22:24
5656
|
5757
LL | fn iter_contra_val<'a, 'new>(v: IterMut<'a, (), &'new ()>) -> IterMut<'a, (), &'static ()> {
5858
| ^^^^
5959
= note: ...does not necessarily outlive the static lifetime
6060

6161
error[E0308]: mismatched types
62-
--> $DIR/variance-btree-invariant-types.rs:17:5
62+
--> $DIR/variance-btree-invariant-types.rs:29:5
6363
|
6464
LL | v
6565
| ^ lifetime mismatch
6666
|
6767
= note: expected struct `RangeMut<'_, &'new (), _>`
6868
found struct `RangeMut<'_, &'static (), _>`
6969
note: the lifetime `'new` as defined here...
70-
--> $DIR/variance-btree-invariant-types.rs:16:22
70+
--> $DIR/variance-btree-invariant-types.rs:28:22
7171
|
7272
LL | fn range_cov_key<'a, 'new>(v: RangeMut<'a, &'static (), ()>) -> RangeMut<'a, &'new (), ()> {
7373
| ^^^^
7474
= note: ...does not necessarily outlive the static lifetime
7575

7676
error[E0308]: mismatched types
77-
--> $DIR/variance-btree-invariant-types.rs:20:5
77+
--> $DIR/variance-btree-invariant-types.rs:34:5
7878
|
7979
LL | v
8080
| ^ lifetime mismatch
8181
|
8282
= note: expected struct `RangeMut<'_, _, &'new ()>`
8383
found struct `RangeMut<'_, _, &'static ()>`
8484
note: the lifetime `'new` as defined here...
85-
--> $DIR/variance-btree-invariant-types.rs:19:22
85+
--> $DIR/variance-btree-invariant-types.rs:33:22
8686
|
8787
LL | fn range_cov_val<'a, 'new>(v: RangeMut<'a, (), &'static ()>) -> RangeMut<'a, (), &'new ()> {
8888
| ^^^^
8989
= note: ...does not necessarily outlive the static lifetime
9090

9191
error[E0308]: mismatched types
92-
--> $DIR/variance-btree-invariant-types.rs:23:5
92+
--> $DIR/variance-btree-invariant-types.rs:39:5
9393
|
9494
LL | v
9595
| ^ lifetime mismatch
9696
|
9797
= note: expected struct `RangeMut<'_, &'static (), _>`
9898
found struct `RangeMut<'_, &'new (), _>`
9999
note: the lifetime `'new` as defined here...
100-
--> $DIR/variance-btree-invariant-types.rs:22:25
100+
--> $DIR/variance-btree-invariant-types.rs:38:25
101101
|
102102
LL | fn range_contra_key<'a, 'new>(v: RangeMut<'a, &'new (), ()>) -> RangeMut<'a, &'static (), ()> {
103103
| ^^^^
104104
= note: ...does not necessarily outlive the static lifetime
105105

106106
error[E0308]: mismatched types
107-
--> $DIR/variance-btree-invariant-types.rs:26:5
107+
--> $DIR/variance-btree-invariant-types.rs:44:5
108108
|
109109
LL | v
110110
| ^ lifetime mismatch
111111
|
112112
= note: expected struct `RangeMut<'_, _, &'static ()>`
113113
found struct `RangeMut<'_, _, &'new ()>`
114114
note: the lifetime `'new` as defined here...
115-
--> $DIR/variance-btree-invariant-types.rs:25:25
115+
--> $DIR/variance-btree-invariant-types.rs:43:25
116116
|
117117
LL | fn range_contra_val<'a, 'new>(v: RangeMut<'a, (), &'new ()>) -> RangeMut<'a, (), &'static ()> {
118118
| ^^^^
119119
= note: ...does not necessarily outlive the static lifetime
120120

121121
error[E0308]: mismatched types
122-
--> $DIR/variance-btree-invariant-types.rs:31:5
122+
--> $DIR/variance-btree-invariant-types.rs:51:5
123123
|
124124
LL | v
125125
| ^ lifetime mismatch
126126
|
127127
= note: expected struct `std::collections::btree_map::OccupiedEntry<'_, &'new (), _>`
128128
found struct `std::collections::btree_map::OccupiedEntry<'_, &'static (), _>`
129129
note: the lifetime `'new` as defined here...
130-
--> $DIR/variance-btree-invariant-types.rs:29:20
130+
--> $DIR/variance-btree-invariant-types.rs:49:20
131131
|
132132
LL | fn occ_cov_key<'a, 'new>(v: OccupiedEntry<'a, &'static (), ()>)
133133
| ^^^^
134134
= note: ...does not necessarily outlive the static lifetime
135135

136136
error[E0308]: mismatched types
137-
--> $DIR/variance-btree-invariant-types.rs:35:5
137+
--> $DIR/variance-btree-invariant-types.rs:57:5
138138
|
139139
LL | v
140140
| ^ lifetime mismatch
141141
|
142142
= note: expected struct `std::collections::btree_map::OccupiedEntry<'_, _, &'new ()>`
143143
found struct `std::collections::btree_map::OccupiedEntry<'_, _, &'static ()>`
144144
note: the lifetime `'new` as defined here...
145-
--> $DIR/variance-btree-invariant-types.rs:33:20
145+
--> $DIR/variance-btree-invariant-types.rs:55:20
146146
|
147147
LL | fn occ_cov_val<'a, 'new>(v: OccupiedEntry<'a, (), &'static ()>)
148148
| ^^^^
149149
= note: ...does not necessarily outlive the static lifetime
150150

151151
error[E0308]: mismatched types
152-
--> $DIR/variance-btree-invariant-types.rs:39:5
152+
--> $DIR/variance-btree-invariant-types.rs:63:5
153153
|
154154
LL | v
155155
| ^ lifetime mismatch
156156
|
157157
= note: expected struct `std::collections::btree_map::OccupiedEntry<'_, &'static (), _>`
158158
found struct `std::collections::btree_map::OccupiedEntry<'_, &'new (), _>`
159159
note: the lifetime `'new` as defined here...
160-
--> $DIR/variance-btree-invariant-types.rs:37:23
160+
--> $DIR/variance-btree-invariant-types.rs:61:23
161161
|
162162
LL | fn occ_contra_key<'a, 'new>(v: OccupiedEntry<'a, &'new (), ()>)
163163
| ^^^^
164164
= note: ...does not necessarily outlive the static lifetime
165165

166166
error[E0308]: mismatched types
167-
--> $DIR/variance-btree-invariant-types.rs:43:5
167+
--> $DIR/variance-btree-invariant-types.rs:69:5
168168
|
169169
LL | v
170170
| ^ lifetime mismatch
171171
|
172172
= note: expected struct `std::collections::btree_map::OccupiedEntry<'_, _, &'static ()>`
173173
found struct `std::collections::btree_map::OccupiedEntry<'_, _, &'new ()>`
174174
note: the lifetime `'new` as defined here...
175-
--> $DIR/variance-btree-invariant-types.rs:41:23
175+
--> $DIR/variance-btree-invariant-types.rs:67:23
176176
|
177177
LL | fn occ_contra_val<'a, 'new>(v: OccupiedEntry<'a, (), &'new ()>)
178178
| ^^^^
179179
= note: ...does not necessarily outlive the static lifetime
180180

181181
error[E0308]: mismatched types
182-
--> $DIR/variance-btree-invariant-types.rs:48:5
182+
--> $DIR/variance-btree-invariant-types.rs:76:5
183183
|
184184
LL | v
185185
| ^ lifetime mismatch
186186
|
187187
= note: expected struct `std::collections::btree_map::VacantEntry<'_, &'new (), _>`
188188
found struct `std::collections::btree_map::VacantEntry<'_, &'static (), _>`
189189
note: the lifetime `'new` as defined here...
190-
--> $DIR/variance-btree-invariant-types.rs:46:20
190+
--> $DIR/variance-btree-invariant-types.rs:74:20
191191
|
192192
LL | fn vac_cov_key<'a, 'new>(v: VacantEntry<'a, &'static (), ()>)
193193
| ^^^^
194194
= note: ...does not necessarily outlive the static lifetime
195195

196196
error[E0308]: mismatched types
197-
--> $DIR/variance-btree-invariant-types.rs:52:5
197+
--> $DIR/variance-btree-invariant-types.rs:82:5
198198
|
199199
LL | v
200200
| ^ lifetime mismatch
201201
|
202202
= note: expected struct `std::collections::btree_map::VacantEntry<'_, _, &'new ()>`
203203
found struct `std::collections::btree_map::VacantEntry<'_, _, &'static ()>`
204204
note: the lifetime `'new` as defined here...
205-
--> $DIR/variance-btree-invariant-types.rs:50:20
205+
--> $DIR/variance-btree-invariant-types.rs:80:20
206206
|
207207
LL | fn vac_cov_val<'a, 'new>(v: VacantEntry<'a, (), &'static ()>)
208208
| ^^^^
209209
= note: ...does not necessarily outlive the static lifetime
210210

211211
error[E0308]: mismatched types
212-
--> $DIR/variance-btree-invariant-types.rs:56:5
212+
--> $DIR/variance-btree-invariant-types.rs:88:5
213213
|
214214
LL | v
215215
| ^ lifetime mismatch
216216
|
217217
= note: expected struct `std::collections::btree_map::VacantEntry<'_, &'static (), _>`
218218
found struct `std::collections::btree_map::VacantEntry<'_, &'new (), _>`
219219
note: the lifetime `'new` as defined here...
220-
--> $DIR/variance-btree-invariant-types.rs:54:23
220+
--> $DIR/variance-btree-invariant-types.rs:86:23
221221
|
222222
LL | fn vac_contra_key<'a, 'new>(v: VacantEntry<'a, &'new (), ()>)
223223
| ^^^^
224224
= note: ...does not necessarily outlive the static lifetime
225225

226226
error[E0308]: mismatched types
227-
--> $DIR/variance-btree-invariant-types.rs:60:5
227+
--> $DIR/variance-btree-invariant-types.rs:94:5
228228
|
229229
LL | v
230230
| ^ lifetime mismatch
231231
|
232232
= note: expected struct `std::collections::btree_map::VacantEntry<'_, _, &'static ()>`
233233
found struct `std::collections::btree_map::VacantEntry<'_, _, &'new ()>`
234234
note: the lifetime `'new` as defined here...
235-
--> $DIR/variance-btree-invariant-types.rs:58:23
235+
--> $DIR/variance-btree-invariant-types.rs:92:23
236236
|
237237
LL | fn vac_contra_val<'a, 'new>(v: VacantEntry<'a, (), &'new ()>)
238238
| ^^^^

0 commit comments

Comments
 (0)