Skip to content

Commit f881bf7

Browse files
committed
unboxed-closures and type-alias-impl-trait nll revisions
1 parent a2946ae commit f881bf7

12 files changed

+42
-20
lines changed

src/test/ui/type-alias-impl-trait/generic_type_does_not_live_long_enough.stderr renamed to src/test/ui/type-alias-impl-trait/generic_type_does_not_live_long_enough.base.stderr

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
error: at least one trait must be specified
2-
--> $DIR/generic_type_does_not_live_long_enough.rs:10:24
2+
--> $DIR/generic_type_does_not_live_long_enough.rs:14:24
33
|
44
LL | type WrongGeneric<T> = impl 'static;
55
| ^^^^^^^^^^^^
66

77
error: non-defining opaque type use in defining scope
8-
--> $DIR/generic_type_does_not_live_long_enough.rs:6:18
8+
--> $DIR/generic_type_does_not_live_long_enough.rs:10:18
99
|
1010
LL | let z: i32 = x;
1111
| ^
1212
|
1313
note: used non-generic type `&'static i32` for generic parameter
14-
--> $DIR/generic_type_does_not_live_long_enough.rs:10:19
14+
--> $DIR/generic_type_does_not_live_long_enough.rs:14:19
1515
|
1616
LL | type WrongGeneric<T> = impl 'static;
1717
| ^
1818

1919
error[E0310]: the parameter type `T` may not live long enough
20-
--> $DIR/generic_type_does_not_live_long_enough.rs:14:5
20+
--> $DIR/generic_type_does_not_live_long_enough.rs:18:5
2121
|
2222
LL | fn wrong_generic<T>(t: T) -> WrongGeneric<T> {
2323
| - help: consider adding an explicit lifetime bound...: `T: 'static`

src/test/ui/type-alias-impl-trait/generic_type_does_not_live_long_enough.nll.stderr

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
error: at least one trait must be specified
2-
--> $DIR/generic_type_does_not_live_long_enough.rs:10:24
2+
--> $DIR/generic_type_does_not_live_long_enough.rs:14:24
33
|
44
LL | type WrongGeneric<T> = impl 'static;
55
| ^^^^^^^^^^^^
66

77
error: non-defining opaque type use in defining scope
8-
--> $DIR/generic_type_does_not_live_long_enough.rs:6:18
8+
--> $DIR/generic_type_does_not_live_long_enough.rs:10:18
99
|
1010
LL | let z: i32 = x;
1111
| ^
1212
|
1313
note: used non-generic type `&'static i32` for generic parameter
14-
--> $DIR/generic_type_does_not_live_long_enough.rs:10:19
14+
--> $DIR/generic_type_does_not_live_long_enough.rs:14:19
1515
|
1616
LL | type WrongGeneric<T> = impl 'static;
1717
| ^
1818

1919
error[E0310]: the parameter type `T` may not live long enough
20-
--> $DIR/generic_type_does_not_live_long_enough.rs:14:5
20+
--> $DIR/generic_type_does_not_live_long_enough.rs:18:5
2121
|
2222
LL | t
2323
| ^

src/test/ui/type-alias-impl-trait/generic_type_does_not_live_long_enough.rs

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
#![feature(type_alias_impl_trait)]
22

3+
// revisions: base nll
4+
// ignore-compare-mode-nll
5+
//[nll] compile-flags: -Z borrowck=mir
6+
37
fn main() {
48
let y = 42;
59
let x = wrong_generic(&y);

src/test/ui/type-alias-impl-trait/issue-57611-trait-alias.stderr renamed to src/test/ui/type-alias-impl-trait/issue-57611-trait-alias.base.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: implementation of `FnOnce` is not general enough
2-
--> $DIR/issue-57611-trait-alias.rs:20:9
2+
--> $DIR/issue-57611-trait-alias.rs:25:9
33
|
44
LL | |x| x
55
| ^^^^^ implementation of `FnOnce` is not general enough

src/test/ui/type-alias-impl-trait/issue-57611-trait-alias.nll.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
error[E0308]: mismatched types
2-
--> $DIR/issue-57611-trait-alias.rs:20:9
2+
--> $DIR/issue-57611-trait-alias.rs:25:9
33
|
44
LL | |x| x
55
| ^^^^^ one type is more general than the other
66
|
77
= note: expected type `for<'r> Fn<(&'r X,)>`
88
found type `Fn<(&X,)>`
99
note: this closure does not fulfill the lifetime requirements
10-
--> $DIR/issue-57611-trait-alias.rs:20:9
10+
--> $DIR/issue-57611-trait-alias.rs:25:9
1111
|
1212
LL | |x| x
1313
| ^^^^^
1414

1515
error: implementation of `FnOnce` is not general enough
16-
--> $DIR/issue-57611-trait-alias.rs:20:9
16+
--> $DIR/issue-57611-trait-alias.rs:25:9
1717
|
1818
LL | |x| x
1919
| ^^^^^ implementation of `FnOnce` is not general enough

src/test/ui/type-alias-impl-trait/issue-57611-trait-alias.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
// Regression test for issue #57611
22
// Ensures that we don't ICE
33
// FIXME: This should compile, but it currently doesn't
4+
// known-bug
5+
6+
// revisions: base nll
7+
// ignore-compare-mode-nll
8+
//[nll] compile-flags: -Z borrowck=mir
49

510
#![feature(trait_alias)]
611
#![feature(type_alias_impl_trait)]
@@ -18,7 +23,6 @@ impl Foo for X {
1823

1924
fn bar(&self) -> Self::Bar {
2025
|x| x
21-
//~^ ERROR implementation of `FnOnce` is not general enough
2226
}
2327
}
2428

src/test/ui/unboxed-closures/issue-30906.stderr renamed to src/test/ui/unboxed-closures/issue-30906.base.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: implementation of `FnOnce` is not general enough
2-
--> $DIR/issue-30906.rs:18:5
2+
--> $DIR/issue-30906.rs:22:5
33
|
44
LL | test(Compose(f, |_| {}));
55
| ^^^^ implementation of `FnOnce` is not general enough

src/test/ui/unboxed-closures/issue-30906.nll.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: implementation of `FnOnce` is not general enough
2-
--> $DIR/issue-30906.rs:18:5
2+
--> $DIR/issue-30906.rs:22:5
33
|
44
LL | test(Compose(f, |_| {}));
55
| ^^^^^^^^^^^^^^^^^^^^^^^^ implementation of `FnOnce` is not general enough

src/test/ui/unboxed-closures/issue-30906.rs

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
#![feature(fn_traits, unboxed_closures)]
22

3+
// revisions: base nll
4+
// ignore-compare-mode-nll
5+
//[nll] compile-flags: -Z borrowck=mir
6+
37
fn test<F: for<'x> FnOnce<(&'x str,)>>(_: F) {}
48

59
struct Compose<F, G>(F, G);

src/test/ui/unboxed-closures/unboxed-closures-infer-argument-types-two-region-pointers.stderr renamed to src/test/ui/unboxed-closures/unboxed-closures-infer-argument-types-two-region-pointers.base.stderr

+7-3
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,27 @@
11
error[E0312]: lifetime of reference outlives lifetime of borrowed content...
2-
--> $DIR/unboxed-closures-infer-argument-types-two-region-pointers.rs:17:15
2+
--> $DIR/unboxed-closures-infer-argument-types-two-region-pointers.rs:21:15
33
|
44
LL | x.set(y);
55
| ^
66
|
77
note: ...the reference is valid for the anonymous lifetime #2 defined here...
8-
--> $DIR/unboxed-closures-infer-argument-types-two-region-pointers.rs:16:14
8+
--> $DIR/unboxed-closures-infer-argument-types-two-region-pointers.rs:20:14
99
|
1010
LL | doit(0, &|x, y| {
1111
| ______________^
1212
LL | | x.set(y);
13+
LL | |
14+
LL | |
1315
LL | | });
1416
| |_____^
1517
note: ...but the borrowed content is only valid for the anonymous lifetime #3 defined here
16-
--> $DIR/unboxed-closures-infer-argument-types-two-region-pointers.rs:16:14
18+
--> $DIR/unboxed-closures-infer-argument-types-two-region-pointers.rs:20:14
1719
|
1820
LL | doit(0, &|x, y| {
1921
| ______________^
2022
LL | | x.set(y);
23+
LL | |
24+
LL | |
2125
LL | | });
2226
| |_____^
2327

src/test/ui/unboxed-closures/unboxed-closures-infer-argument-types-two-region-pointers.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/unboxed-closures-infer-argument-types-two-region-pointers.rs:17:9
2+
--> $DIR/unboxed-closures-infer-argument-types-two-region-pointers.rs:21:9
33
|
44
LL | doit(0, &|x, y| {
55
| - - has type `&'1 i32`

src/test/ui/unboxed-closures/unboxed-closures-infer-argument-types-two-region-pointers.rs

+7-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
// That a closure whose expected argument types include two distinct
44
// bound regions.
55

6+
// revisions: base nll
7+
// ignore-compare-mode-nll
8+
//[nll] compile-flags: -Z borrowck=mir
9+
610
use std::cell::Cell;
711

812
fn doit<T,F>(val: T, f: &F)
@@ -14,6 +18,8 @@ fn doit<T,F>(val: T, f: &F)
1418

1519
pub fn main() {
1620
doit(0, &|x, y| {
17-
x.set(y); //~ ERROR E0312
21+
x.set(y);
22+
//[base]~^ ERROR E0312
23+
//[nll]~^^ lifetime may not live long enough
1824
});
1925
}

0 commit comments

Comments
 (0)