Skip to content

Commit 07e7b43

Browse files
committed
Auto merge of rust-lang#97258 - jackh726:nll-revisions, r=cjgillot
Move remaining tests with NLL differences to revisions Based on rust-lang#97206 I've already filed issues for any important differences that I've spotted: rust-lang#97252 rust-lang#97253 rust-lang#97256 rust-lang#97267 There is a lot here, but each commit is self-contained as a separate directory. I can split into separate PRs as wanted or needed.
2 parents b2eed72 + 383fbee commit 07e7b43

File tree

395 files changed

+2273
-1080
lines changed

Some content is hidden

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

395 files changed

+2273
-1080
lines changed

src/test/ui/associated-type-bounds/implied-region-constraints.stderr src/test/ui/associated-type-bounds/implied-region-constraints.base.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0623]: lifetime mismatch
2-
--> $DIR/implied-region-constraints.rs:17:64
2+
--> $DIR/implied-region-constraints.rs:21:64
33
|
44
LL | fn _bad_st<'a, 'b, T>(x: St<'a, 'b, T>)
55
| ------------- this type is declared with multiple lifetimes...
@@ -8,7 +8,7 @@ LL | let _failure_proves_not_implied_outlives_region_b: &'b T = &x.f0;
88
| ^^^^^ ...but data with one lifetime flows into the other here
99

1010
error[E0623]: lifetime mismatch
11-
--> $DIR/implied-region-constraints.rs:38:72
11+
--> $DIR/implied-region-constraints.rs:43:72
1212
|
1313
LL | fn _bad_en7<'a, 'b, T>(x: En7<'a, 'b, T>)
1414
| -------------- this type is declared with multiple lifetimes...

src/test/ui/associated-type-bounds/implied-region-constraints.nll.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: lifetime may not live long enough
2-
--> $DIR/implied-region-constraints.rs:17:56
2+
--> $DIR/implied-region-constraints.rs:21:56
33
|
44
LL | fn _bad_st<'a, 'b, T>(x: St<'a, 'b, T>)
55
| -- -- lifetime `'b` defined here
@@ -12,7 +12,7 @@ LL | let _failure_proves_not_implied_outlives_region_b: &'b T = &x.f0;
1212
= help: consider adding the following bound: `'a: 'b`
1313

1414
error: lifetime may not live long enough
15-
--> $DIR/implied-region-constraints.rs:38:64
15+
--> $DIR/implied-region-constraints.rs:43:64
1616
|
1717
LL | fn _bad_en7<'a, 'b, T>(x: En7<'a, 'b, T>)
1818
| -- -- lifetime `'b` defined here

src/test/ui/associated-type-bounds/implied-region-constraints.rs

+8-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
// revisions: base nll
2+
// ignore-compare-mode-nll
3+
//[nll] compile-flags: -Z borrowck=mir
4+
15
#![feature(associated_type_bounds)]
26

37
trait Tr1 { type As1; }
@@ -15,7 +19,8 @@ where
1519
{
1620
// This should fail because `T: 'b` is not implied from `WF(St<'a, 'b, T>)`.
1721
let _failure_proves_not_implied_outlives_region_b: &'b T = &x.f0;
18-
//~^ ERROR lifetime mismatch [E0623]
22+
//[base]~^ ERROR lifetime mismatch [E0623]
23+
//[nll]~^^ ERROR lifetime may not live long enough
1924
}
2025

2126
enum En7<'a, 'b, T> // `<T::As1 as Tr2>::As2: 'a` is implied.
@@ -36,7 +41,8 @@ where
3641
En7::V0(x) => {
3742
// Also fails for the same reason as above:
3843
let _failure_proves_not_implied_outlives_region_b: &'b T = &x;
39-
//~^ ERROR lifetime mismatch [E0623]
44+
//[base]~^ ERROR lifetime mismatch [E0623]
45+
//[nll]~^^ ERROR lifetime may not live long enough
4046
},
4147
En7::V1(_) => {},
4248
}

src/test/ui/associated-types/associated-types-eq-hr.stderr src/test/ui/associated-types/associated-types-eq-hr.base.stderr

+11-11
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
error[E0271]: type mismatch resolving `for<'x> <UintStruct as TheTrait<&'x isize>>::A == &'x isize`
2-
--> $DIR/associated-types-eq-hr.rs:87:5
2+
--> $DIR/associated-types-eq-hr.rs:91:5
33
|
44
LL | foo::<UintStruct>();
55
| ^^^^^^^^^^^^^^^^^ type mismatch resolving `for<'x> <UintStruct as TheTrait<&'x isize>>::A == &'x isize`
66
|
77
note: expected this to be `&isize`
8-
--> $DIR/associated-types-eq-hr.rs:26:14
8+
--> $DIR/associated-types-eq-hr.rs:30:14
99
|
1010
LL | type A = &'a usize;
1111
| ^^^^^^^^^
1212
= note: expected reference `&isize`
1313
found reference `&usize`
1414
note: required by a bound in `foo`
15-
--> $DIR/associated-types-eq-hr.rs:45:36
15+
--> $DIR/associated-types-eq-hr.rs:49:36
1616
|
1717
LL | fn foo<T>()
1818
| --- required by a bound in this
@@ -21,20 +21,20 @@ LL | T: for<'x> TheTrait<&'x isize, A = &'x isize>,
2121
| ^^^^^^^^^^^^^ required by this bound in `foo`
2222

2323
error[E0271]: type mismatch resolving `for<'x> <IntStruct as TheTrait<&'x isize>>::A == &'x usize`
24-
--> $DIR/associated-types-eq-hr.rs:91:5
24+
--> $DIR/associated-types-eq-hr.rs:95:5
2525
|
2626
LL | bar::<IntStruct>();
2727
| ^^^^^^^^^^^^^^^^ type mismatch resolving `for<'x> <IntStruct as TheTrait<&'x isize>>::A == &'x usize`
2828
|
2929
note: expected this to be `&usize`
30-
--> $DIR/associated-types-eq-hr.rs:14:14
30+
--> $DIR/associated-types-eq-hr.rs:18:14
3131
|
3232
LL | type A = &'a isize;
3333
| ^^^^^^^^^
3434
= note: expected reference `&usize`
3535
found reference `&isize`
3636
note: required by a bound in `bar`
37-
--> $DIR/associated-types-eq-hr.rs:52:36
37+
--> $DIR/associated-types-eq-hr.rs:56:36
3838
|
3939
LL | fn bar<T>()
4040
| --- required by a bound in this
@@ -43,7 +43,7 @@ LL | T: for<'x> TheTrait<&'x isize, A = &'x usize>,
4343
| ^^^^^^^^^^^^^ required by this bound in `bar`
4444

4545
error: implementation of `TheTrait` is not general enough
46-
--> $DIR/associated-types-eq-hr.rs:96:5
46+
--> $DIR/associated-types-eq-hr.rs:100:5
4747
|
4848
LL | tuple_one::<Tuple>();
4949
| ^^^^^^^^^^^^^^^^^^ implementation of `TheTrait` is not general enough
@@ -52,7 +52,7 @@ LL | tuple_one::<Tuple>();
5252
= note: ...but it actually implements `TheTrait<(&'2 isize, &'2 isize)>`, for some specific lifetime `'2`
5353

5454
error: implementation of `TheTrait` is not general enough
55-
--> $DIR/associated-types-eq-hr.rs:96:5
55+
--> $DIR/associated-types-eq-hr.rs:100:5
5656
|
5757
LL | tuple_one::<Tuple>();
5858
| ^^^^^^^^^^^^^^^^^^ implementation of `TheTrait` is not general enough
@@ -61,7 +61,7 @@ LL | tuple_one::<Tuple>();
6161
= note: ...but it actually implements `TheTrait<(&'2 isize, &'2 isize)>`, for some specific lifetime `'2`
6262

6363
error: implementation of `TheTrait` is not general enough
64-
--> $DIR/associated-types-eq-hr.rs:102:5
64+
--> $DIR/associated-types-eq-hr.rs:106:5
6565
|
6666
LL | tuple_two::<Tuple>();
6767
| ^^^^^^^^^^^^^^^^^^ implementation of `TheTrait` is not general enough
@@ -70,7 +70,7 @@ LL | tuple_two::<Tuple>();
7070
= note: ...but it actually implements `TheTrait<(&'2 isize, &'2 isize)>`, for some specific lifetime `'2`
7171

7272
error: implementation of `TheTrait` is not general enough
73-
--> $DIR/associated-types-eq-hr.rs:102:5
73+
--> $DIR/associated-types-eq-hr.rs:106:5
7474
|
7575
LL | tuple_two::<Tuple>();
7676
| ^^^^^^^^^^^^^^^^^^ implementation of `TheTrait` is not general enough
@@ -79,7 +79,7 @@ LL | tuple_two::<Tuple>();
7979
= note: ...but it actually implements `TheTrait<(&'2 isize, &'2 isize)>`, for some specific lifetime `'2`
8080

8181
error: implementation of `TheTrait` is not general enough
82-
--> $DIR/associated-types-eq-hr.rs:112:5
82+
--> $DIR/associated-types-eq-hr.rs:116:5
8383
|
8484
LL | tuple_four::<Tuple>();
8585
| ^^^^^^^^^^^^^^^^^^^ implementation of `TheTrait` is not general enough

src/test/ui/associated-types/associated-types-eq-hr.nll.stderr

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
error[E0271]: type mismatch resolving `for<'x> <UintStruct as TheTrait<&'x isize>>::A == &'x isize`
2-
--> $DIR/associated-types-eq-hr.rs:87:5
2+
--> $DIR/associated-types-eq-hr.rs:91:5
33
|
44
LL | foo::<UintStruct>();
55
| ^^^^^^^^^^^^^^^^^ type mismatch resolving `for<'x> <UintStruct as TheTrait<&'x isize>>::A == &'x isize`
66
|
77
note: expected this to be `&isize`
8-
--> $DIR/associated-types-eq-hr.rs:26:14
8+
--> $DIR/associated-types-eq-hr.rs:30:14
99
|
1010
LL | type A = &'a usize;
1111
| ^^^^^^^^^
1212
= note: expected reference `&isize`
1313
found reference `&usize`
1414
note: required by a bound in `foo`
15-
--> $DIR/associated-types-eq-hr.rs:45:36
15+
--> $DIR/associated-types-eq-hr.rs:49:36
1616
|
1717
LL | fn foo<T>()
1818
| --- required by a bound in this
@@ -21,20 +21,20 @@ LL | T: for<'x> TheTrait<&'x isize, A = &'x isize>,
2121
| ^^^^^^^^^^^^^ required by this bound in `foo`
2222

2323
error[E0271]: type mismatch resolving `for<'x> <IntStruct as TheTrait<&'x isize>>::A == &'x usize`
24-
--> $DIR/associated-types-eq-hr.rs:91:5
24+
--> $DIR/associated-types-eq-hr.rs:95:5
2525
|
2626
LL | bar::<IntStruct>();
2727
| ^^^^^^^^^^^^^^^^ type mismatch resolving `for<'x> <IntStruct as TheTrait<&'x isize>>::A == &'x usize`
2828
|
2929
note: expected this to be `&usize`
30-
--> $DIR/associated-types-eq-hr.rs:14:14
30+
--> $DIR/associated-types-eq-hr.rs:18:14
3131
|
3232
LL | type A = &'a isize;
3333
| ^^^^^^^^^
3434
= note: expected reference `&usize`
3535
found reference `&isize`
3636
note: required by a bound in `bar`
37-
--> $DIR/associated-types-eq-hr.rs:52:36
37+
--> $DIR/associated-types-eq-hr.rs:56:36
3838
|
3939
LL | fn bar<T>()
4040
| --- required by a bound in this

src/test/ui/associated-types/associated-types-eq-hr.rs

+9-5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
// revisions: base nll
2+
// ignore-compare-mode-nll
3+
//[nll] compile-flags: -Z borrowck=mir
4+
15
// Check testing of equality constraints in a higher-ranked context.
26

37
pub trait TheTrait<T> {
@@ -94,14 +98,14 @@ pub fn call_bar() {
9498

9599
pub fn call_tuple_one() {
96100
tuple_one::<Tuple>();
97-
//~^ ERROR implementation of `TheTrait` is not general enough
98-
//~| ERROR implementation of `TheTrait` is not general enough
101+
//[base]~^ ERROR implementation of `TheTrait` is not general enough
102+
//[base]~| ERROR implementation of `TheTrait` is not general enough
99103
}
100104

101105
pub fn call_tuple_two() {
102106
tuple_two::<Tuple>();
103-
//~^ ERROR implementation of `TheTrait` is not general enough
104-
//~| ERROR implementation of `TheTrait` is not general enough
107+
//[base]~^ ERROR implementation of `TheTrait` is not general enough
108+
//[base]~| ERROR implementation of `TheTrait` is not general enough
105109
}
106110

107111
pub fn call_tuple_three() {
@@ -110,7 +114,7 @@ pub fn call_tuple_three() {
110114

111115
pub fn call_tuple_four() {
112116
tuple_four::<Tuple>();
113-
//~^ ERROR implementation of `TheTrait` is not general enough
117+
//[base]~^ ERROR implementation of `TheTrait` is not general enough
114118
}
115119

116120
fn main() {}

src/test/ui/associated-types/associated-types-project-from-hrtb-in-fn-body.stderr src/test/ui/associated-types/associated-types-project-from-hrtb-in-fn-body.base.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0623]: lifetime mismatch
2-
--> $DIR/associated-types-project-from-hrtb-in-fn-body.rs:22:40
2+
--> $DIR/associated-types-project-from-hrtb-in-fn-body.rs:26:40
33
|
44
LL | x: <I as Foo<&'a isize>>::A,
55
| --------- these two types are declared with different lifetimes...

src/test/ui/associated-types/associated-types-project-from-hrtb-in-fn-body.nll.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: lifetime may not live long enough
2-
--> $DIR/associated-types-project-from-hrtb-in-fn-body.rs:22:29
2+
--> $DIR/associated-types-project-from-hrtb-in-fn-body.rs:26:29
33
|
44
LL | fn bar<'a, 'b, I : for<'x> Foo<&'x isize>>(
55
| -- -- lifetime `'b` defined here
@@ -12,7 +12,7 @@ LL | let z: I::A = if cond { x } else { y };
1212
= help: consider adding the following bound: `'a: 'b`
1313

1414
error: lifetime may not live long enough
15-
--> $DIR/associated-types-project-from-hrtb-in-fn-body.rs:22:40
15+
--> $DIR/associated-types-project-from-hrtb-in-fn-body.rs:26:40
1616
|
1717
LL | fn bar<'a, 'b, I : for<'x> Foo<&'x isize>>(
1818
| -- -- lifetime `'b` defined here

src/test/ui/associated-types/associated-types-project-from-hrtb-in-fn-body.rs

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
// ignore-compare-mode-nll
2+
// revisions: base nll
3+
// [nll]compile-flags: -Zborrowck=mir
4+
15
// Check projection of an associated type out of a higher-ranked
26
// trait-bound in the context of a function body.
37

@@ -20,7 +24,9 @@ fn bar<'a, 'b, I : for<'x> Foo<&'x isize>>(
2024
{
2125
// x and y here have two distinct lifetimes:
2226
let z: I::A = if cond { x } else { y };
23-
//~^ ERROR lifetime mismatch
27+
//[base]~^ ERROR lifetime mismatch
28+
//[nll]~^^ ERROR lifetime may not live long enough
29+
//[nll]~| ERROR lifetime may not live long enough
2430
}
2531

2632
pub fn main() {}

src/test/ui/associated-types/associated-types-subtyping-1.stderr src/test/ui/associated-types/associated-types-subtyping-1.base.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0623]: lifetime mismatch
2-
--> $DIR/associated-types-subtyping-1.rs:26:38
2+
--> $DIR/associated-types-subtyping-1.rs:31:38
33
|
44
LL | fn method2<'a,'b,T>(x: &'a T, y: &'b T)
55
| ----- ----- these two types are declared with different lifetimes...
@@ -8,7 +8,7 @@ LL | let _c: <T as Trait<'b>>::Type = a;
88
| ^ ...but data from `y` flows into `x` here
99

1010
error[E0623]: lifetime mismatch
11-
--> $DIR/associated-types-subtyping-1.rs:35:38
11+
--> $DIR/associated-types-subtyping-1.rs:41:38
1212
|
1313
LL | fn method3<'a,'b,T>(x: &'a T, y: &'b T)
1414
| ----- ----- these two types are declared with different lifetimes...

src/test/ui/associated-types/associated-types-subtyping-1.nll.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: lifetime may not live long enough
2-
--> $DIR/associated-types-subtyping-1.rs:24:12
2+
--> $DIR/associated-types-subtyping-1.rs:28:12
33
|
44
LL | fn method2<'a,'b,T>(x: &'a T, y: &'b T)
55
| -- -- lifetime `'b` defined here
@@ -12,7 +12,7 @@ LL | let a: <T as Trait<'a>>::Type = make_any();
1212
= help: consider adding the following bound: `'b: 'a`
1313

1414
error: lifetime may not live long enough
15-
--> $DIR/associated-types-subtyping-1.rs:35:13
15+
--> $DIR/associated-types-subtyping-1.rs:41:13
1616
|
1717
LL | fn method3<'a,'b,T>(x: &'a T, y: &'b T)
1818
| -- -- lifetime `'b` defined here

src/test/ui/associated-types/associated-types-subtyping-1.rs

+10-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
// ignore-compare-mode-nll
2+
// revisions: base nll
3+
// [nll]compile-flags: -Zborrowck=mir
4+
15
#![allow(unused_variables)]
26

37
fn make_any<T>() -> T { loop {} }
@@ -22,8 +26,10 @@ fn method2<'a,'b,T>(x: &'a T, y: &'b T)
2226
{
2327
// Note that &'static T <: &'a T.
2428
let a: <T as Trait<'a>>::Type = make_any();
29+
//[nll]~^ ERROR lifetime may not live long enough
2530
let b: <T as Trait<'b>>::Type = make_any();
26-
let _c: <T as Trait<'b>>::Type = a; //~ ERROR E0623
31+
let _c: <T as Trait<'b>>::Type = a;
32+
//[base]~^ ERROR E0623
2733
}
2834

2935
fn method3<'a,'b,T>(x: &'a T, y: &'b T)
@@ -32,7 +38,9 @@ fn method3<'a,'b,T>(x: &'a T, y: &'b T)
3238
// Note that &'static T <: &'a T.
3339
let a: <T as Trait<'a>>::Type = make_any();
3440
let b: <T as Trait<'b>>::Type = make_any();
35-
let _c: <T as Trait<'a>>::Type = b; //~ ERROR E0623
41+
let _c: <T as Trait<'a>>::Type = b;
42+
//[base]~^ ERROR E0623
43+
//[nll]~^^ ERROR lifetime may not live long enough
3644
}
3745

3846
fn method4<'a,'b,T>(x: &'a T, y: &'b T)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
error[E0623]: lifetime mismatch
2+
--> $DIR/project-fn-ret-contravariant-nll.rs:51:5
3+
|
4+
LL | fn transmute<'a,'b>(x: &'a u32, y: &'b u32) -> (&'a u32, &'b u32) {
5+
| ------- ------------------
6+
| |
7+
| this parameter and the return type are declared with different lifetimes...
8+
...
9+
LL | (a, b)
10+
| ^ ...but data from `y` is returned here
11+
12+
error[E0623]: lifetime mismatch
13+
--> $DIR/project-fn-ret-contravariant-nll.rs:51:8
14+
|
15+
LL | fn transmute<'a,'b>(x: &'a u32, y: &'b u32) -> (&'a u32, &'b u32) {
16+
| ------- ------------------
17+
| |
18+
| this parameter and the return type are declared with different lifetimes...
19+
...
20+
LL | (a, b)
21+
| ^ ...but data from `x` is returned here
22+
23+
error: aborting due to 2 previous errors
24+
25+
For more information about this error, try `rustc --explain E0623`.

0 commit comments

Comments
 (0)