Skip to content

Commit 62806f7

Browse files
committed
Use revisions for NLL in generator
1 parent 12a2d79 commit 62806f7

9 files changed

+39
-24
lines changed

src/test/ui/generator/auto-trait-regions.stderr renamed to src/test/ui/generator/auto-trait-regions.base.stderr

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: implementation of `Foo` is not general enough
2-
--> $DIR/auto-trait-regions.rs:31:5
2+
--> $DIR/auto-trait-regions.rs:35:5
33
|
44
LL | assert_foo(gen);
55
| ^^^^^^^^^^ implementation of `Foo` is not general enough
@@ -8,7 +8,7 @@ LL | assert_foo(gen);
88
= note: ...but `Foo` is actually implemented for the type `&'static OnlyFooIfStaticRef`
99

1010
error: implementation of `Foo` is not general enough
11-
--> $DIR/auto-trait-regions.rs:31:5
11+
--> $DIR/auto-trait-regions.rs:35:5
1212
|
1313
LL | assert_foo(gen);
1414
| ^^^^^^^^^^ implementation of `Foo` is not general enough
@@ -17,7 +17,7 @@ LL | assert_foo(gen);
1717
= note: ...but `Foo` is actually implemented for the type `&'static OnlyFooIfStaticRef`
1818

1919
error: implementation of `Foo` is not general enough
20-
--> $DIR/auto-trait-regions.rs:50:5
20+
--> $DIR/auto-trait-regions.rs:56:5
2121
|
2222
LL | assert_foo(gen);
2323
| ^^^^^^^^^^ implementation of `Foo` is not general enough
@@ -26,7 +26,7 @@ LL | assert_foo(gen);
2626
= note: ...but `Foo` is actually implemented for the type `A<'_, '2>`, for some specific lifetime `'2`
2727

2828
error: implementation of `Foo` is not general enough
29-
--> $DIR/auto-trait-regions.rs:50:5
29+
--> $DIR/auto-trait-regions.rs:56:5
3030
|
3131
LL | assert_foo(gen);
3232
| ^^^^^^^^^^ implementation of `Foo` is not general enough

src/test/ui/generator/auto-trait-regions.nll.stderr

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,31 @@
11
error[E0716]: temporary value dropped while borrowed
2-
--> $DIR/auto-trait-regions.rs:46:24
2+
--> $DIR/auto-trait-regions.rs:50:24
33
|
44
LL | let a = A(&mut true, &mut true, No);
55
| ^^^^ - temporary value is freed at the end of this statement
66
| |
77
| creates a temporary which is freed while still in use
8-
LL | yield;
8+
...
99
LL | assert_foo(a);
1010
| - borrow later used here
1111
|
1212
= note: consider using a `let` binding to create a longer lived value
1313

1414
error[E0716]: temporary value dropped while borrowed
15-
--> $DIR/auto-trait-regions.rs:46:35
15+
--> $DIR/auto-trait-regions.rs:50:35
1616
|
1717
LL | let a = A(&mut true, &mut true, No);
1818
| ^^^^ - temporary value is freed at the end of this statement
1919
| |
2020
| creates a temporary which is freed while still in use
21-
LL | yield;
21+
...
2222
LL | assert_foo(a);
2323
| - borrow later used here
2424
|
2525
= note: consider using a `let` binding to create a longer lived value
2626

2727
error: implementation of `Foo` is not general enough
28-
--> $DIR/auto-trait-regions.rs:31:5
28+
--> $DIR/auto-trait-regions.rs:35:5
2929
|
3030
LL | assert_foo(gen);
3131
| ^^^^^^^^^^^^^^^ implementation of `Foo` is not general enough
@@ -34,7 +34,7 @@ LL | assert_foo(gen);
3434
= note: ...but `Foo` is actually implemented for the type `&'static OnlyFooIfStaticRef`
3535

3636
error: implementation of `Foo` is not general enough
37-
--> $DIR/auto-trait-regions.rs:50:5
37+
--> $DIR/auto-trait-regions.rs:56:5
3838
|
3939
LL | assert_foo(gen);
4040
| ^^^^^^^^^^^^^^^ implementation of `Foo` is not general enough

src/test/ui/generator/auto-trait-regions.rs

Lines changed: 8 additions & 2 deletions
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
#![feature(generators)]
26
#![feature(auto_traits)]
37
#![feature(negative_impls)]
@@ -30,7 +34,7 @@ fn main() {
3034
};
3135
assert_foo(gen);
3236
//~^ ERROR implementation of `Foo` is not general enough
33-
//~| ERROR implementation of `Foo` is not general enough
37+
//[base]~^^ ERROR implementation of `Foo` is not general enough
3438

3539
// Allow impls which matches any lifetime
3640
let x = &OnlyFooIfRef(No);
@@ -44,10 +48,12 @@ fn main() {
4448
// Disallow impls which relates lifetimes in the generator interior
4549
let gen = || {
4650
let a = A(&mut true, &mut true, No);
51+
//[nll]~^ temporary value dropped while borrowed
52+
//[nll]~| temporary value dropped while borrowed
4753
yield;
4854
assert_foo(a);
4955
};
5056
assert_foo(gen);
5157
//~^ ERROR not general enough
52-
//~| ERROR not general enough
58+
//[base]~^^ ERROR not general enough
5359
}

src/test/ui/generator/generator-region-requirements.stderr renamed to src/test/ui/generator/generator-region-requirements.base.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0759]: `x` has an anonymous lifetime `'_` but it needs to satisfy a `'static` lifetime requirement
2-
--> $DIR/generator-region-requirements.rs:8:9
2+
--> $DIR/generator-region-requirements.rs:12:9
33
|
44
LL | fn dangle(x: &mut i32) -> &'static mut i32 {
55
| -------- this data with an anonymous lifetime `'_`...

src/test/ui/generator/generator-region-requirements.nll.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: lifetime may not live long enough
2-
--> $DIR/generator-region-requirements.rs:13:51
2+
--> $DIR/generator-region-requirements.rs:17:51
33
|
44
LL | fn dangle(x: &mut i32) -> &'static mut i32 {
55
| - let's call the lifetime of this reference `'1`

src/test/ui/generator/generator-region-requirements.rs

Lines changed: 6 additions & 1 deletion
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
#![feature(generators, generator_trait)]
26
use std::ops::{Generator, GeneratorState};
37
use std::pin::Pin;
@@ -6,11 +10,12 @@ fn dangle(x: &mut i32) -> &'static mut i32 {
610
let mut g = || {
711
yield;
812
x
9-
//~^ ERROR `x` has an anonymous lifetime `'_` but it needs to satisfy a `'static` lifetime requirement [E0759]
13+
//[base]~^ ERROR `x` has an anonymous lifetime `'_` but it needs to satisfy a `'static` lifetime requirement [E0759]
1014
};
1115
loop {
1216
match Pin::new(&mut g).resume(()) {
1317
GeneratorState::Complete(c) => return c,
18+
//[nll]~^ ERROR lifetime may not live long enough
1419
GeneratorState::Yielded(_) => (),
1520
}
1621
}

src/test/ui/generator/resume-arg-late-bound.stderr renamed to src/test/ui/generator/resume-arg-late-bound.base.stderr

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
error[E0308]: mismatched types
2-
--> $DIR/resume-arg-late-bound.rs:15:5
2+
--> $DIR/resume-arg-late-bound.rs:19:5
33
|
44
LL | test(gen);
55
| ^^^^ lifetime mismatch
66
|
77
= note: expected type `for<'a> Generator<&'a mut bool>`
88
found type `Generator<&mut bool>`
99
note: the required lifetime does not necessarily outlive the anonymous lifetime #1 defined here
10-
--> $DIR/resume-arg-late-bound.rs:11:15
10+
--> $DIR/resume-arg-late-bound.rs:15:15
1111
|
1212
LL | let gen = |arg: &mut bool| {
1313
| _______________^
@@ -16,21 +16,21 @@ LL | | *arg = true;
1616
LL | | };
1717
| |_____^
1818
note: the lifetime requirement is introduced here
19-
--> $DIR/resume-arg-late-bound.rs:8:17
19+
--> $DIR/resume-arg-late-bound.rs:12:17
2020
|
2121
LL | fn test(a: impl for<'a> Generator<&'a mut bool>) {}
2222
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2323

2424
error[E0308]: mismatched types
25-
--> $DIR/resume-arg-late-bound.rs:15:5
25+
--> $DIR/resume-arg-late-bound.rs:19:5
2626
|
2727
LL | test(gen);
2828
| ^^^^ lifetime mismatch
2929
|
3030
= note: expected type `for<'a> Generator<&'a mut bool>`
3131
found type `Generator<&mut bool>`
3232
note: the anonymous lifetime #1 defined here doesn't meet the lifetime requirements
33-
--> $DIR/resume-arg-late-bound.rs:11:15
33+
--> $DIR/resume-arg-late-bound.rs:15:15
3434
|
3535
LL | let gen = |arg: &mut bool| {
3636
| _______________^
@@ -39,7 +39,7 @@ LL | | *arg = true;
3939
LL | | };
4040
| |_____^
4141
note: the lifetime requirement is introduced here
42-
--> $DIR/resume-arg-late-bound.rs:8:17
42+
--> $DIR/resume-arg-late-bound.rs:12:17
4343
|
4444
LL | fn test(a: impl for<'a> Generator<&'a mut bool>) {}
4545
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

src/test/ui/generator/resume-arg-late-bound.nll.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
error[E0308]: mismatched types
2-
--> $DIR/resume-arg-late-bound.rs:15:5
2+
--> $DIR/resume-arg-late-bound.rs:19:5
33
|
44
LL | test(gen);
55
| ^^^^^^^^^ one type is more general than the other
66
|
77
= note: expected type `for<'a> Generator<&'a mut bool>`
88
found type `Generator<&mut bool>`
99
note: the lifetime requirement is introduced here
10-
--> $DIR/resume-arg-late-bound.rs:8:17
10+
--> $DIR/resume-arg-late-bound.rs:12:17
1111
|
1212
LL | fn test(a: impl for<'a> Generator<&'a mut bool>) {}
1313
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

src/test/ui/generator/resume-arg-late-bound.rs

Lines changed: 5 additions & 1 deletion
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
//! Tests that we cannot produce a generator that accepts a resume argument
26
//! with any lifetime and then stores it across a `yield`.
37
@@ -14,5 +18,5 @@ fn main() {
1418
};
1519
test(gen);
1620
//~^ ERROR mismatched types
17-
//~| ERROR mismatched types
21+
//[base]~^^ ERROR mismatched types
1822
}

0 commit comments

Comments
 (0)