Skip to content

Commit 07ee532

Browse files
committed
improve tests with migration mode, mir mode
1 parent cc581bf commit 07ee532

13 files changed

+101
-94
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
warning[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
2+
--> $DIR/inverse-bounds.rs:18:70
3+
|
4+
LL | fn upper_bounds<'a, 'b, 'c, 'd, 'e>(a: Invert<'a>, b: Invert<'b>) -> impl Trait<'d, 'e>
5+
| ^^^^^^^^^^^^^^^^^^
6+
|
7+
= note: hidden type `Invert<'_>` captures lifetime '_#8r
8+
= warning: this error has been downgraded to a warning for backwards compatibility with previous releases
9+
= warning: this represents potential undefined behavior in your code and this warning will become a hard error in the future
10+
= note: for more information, try `rustc --explain E0729`
11+
12+
warning: the feature `pin` has been stable since 1.33.0 and no longer requires an attribute to enable
13+
--> $DIR/inverse-bounds.rs:6:60
14+
|
15+
LL | #![feature(arbitrary_self_types, async_await, await_macro, pin)]
16+
| ^^^
17+
|
18+
= note: #[warn(stable_features)] on by default
19+

src/test/ui/impl-trait/multiple-lifetimes/inverse-bounds.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
// edition:2018
2+
// run-pass
3+
// revisions: migrate mir
4+
//[mir]compile-flags: -Z borrowck=mir
25

36
#![feature(arbitrary_self_types, async_await, await_macro, pin)]
47

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,19 @@
1-
error: impl Trait captures unexpected lifetime
2-
--> $DIR/inverse-bounds.rs:15:70
1+
warning[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
2+
--> $DIR/inverse-bounds.rs:16:70
33
|
44
LL | fn upper_bounds<'a, 'b, 'c, 'd, 'e>(a: Invert<'a>, b: Invert<'b>) -> impl Trait<'d, 'e>
5-
| ^^^^^^^^^^^^^^^^^^ only lifetimes that appear in the impl Trait bounds may be captured
5+
| ^^^^^^^^^^^^^^^^^^
66
|
7-
note: hidden type captures the lifetime 'd as defined on the function body at 15:29
8-
--> $DIR/inverse-bounds.rs:15:29
9-
|
10-
LL | fn upper_bounds<'a, 'b, 'c, 'd, 'e>(a: Invert<'a>, b: Invert<'b>) -> impl Trait<'d, 'e>
11-
| ^^
12-
note: hidden type would be allowed to capture the lifetime 'd as defined on the function body at 15:29
13-
--> $DIR/inverse-bounds.rs:15:29
7+
= note: hidden type `Invert<'_>` captures lifetime '_#8r
8+
= warning: this error has been downgraded to a warning for backwards compatibility with previous releases
9+
= warning: this represents potential undefined behavior in your code and this warning will become a hard error in the future
10+
= note: for more information, try `rustc --explain E0729`
11+
12+
warning: the feature `pin` has been stable since 1.33.0 and no longer requires an attribute to enable
13+
--> $DIR/inverse-bounds.rs:4:60
1414
|
15-
LL | fn upper_bounds<'a, 'b, 'c, 'd, 'e>(a: Invert<'a>, b: Invert<'b>) -> impl Trait<'d, 'e>
16-
| ^^
17-
note: hidden type would be allowed to capture the lifetime 'e as defined on the function body at 15:33
18-
--> $DIR/inverse-bounds.rs:15:33
15+
LL | #![feature(arbitrary_self_types, async_await, await_macro, pin)]
16+
| ^^^
1917
|
20-
LL | fn upper_bounds<'a, 'b, 'c, 'd, 'e>(a: Invert<'a>, b: Invert<'b>) -> impl Trait<'d, 'e>
21-
| ^^
22-
= note: hidden type would be allowed to capture the static lifetime
23-
24-
error: aborting due to previous error
18+
= note: #[warn(stable_features)] on by default
2519

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
warning[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
2+
--> $DIR/ordinary-bounds-pick-original.rs:12:50
3+
|
4+
LL | fn upper_bounds<'a, 'b>(a: &'a u8, b: &'b u8) -> impl Trait<'a, 'b> {
5+
| ^^^^^^^^^^^^^^^^^^
6+
|
7+
= note: hidden type `(&u8, &u8)` captures lifetime '_#6r
8+
= warning: this error has been downgraded to a warning for backwards compatibility with previous releases
9+
= warning: this represents potential undefined behavior in your code and this warning will become a hard error in the future
10+
= note: for more information, try `rustc --explain E0729`
11+
12+
warning[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
13+
--> $DIR/ordinary-bounds-pick-original.rs:12:50
14+
|
15+
LL | fn upper_bounds<'a, 'b>(a: &'a u8, b: &'b u8) -> impl Trait<'a, 'b> {
16+
| ^^^^^^^^^^^^^^^^^^
17+
|
18+
= note: hidden type `(&u8, &u8)` captures lifetime '_#7r
19+
= warning: this error has been downgraded to a warning for backwards compatibility with previous releases
20+
= warning: this represents potential undefined behavior in your code and this warning will become a hard error in the future
21+
= note: for more information, try `rustc --explain E0729`
22+

src/test/ui/impl-trait/multiple-lifetimes/ordinary-bounds-pick-original.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// edition:2018
2-
3-
#![feature(arbitrary_self_types, async_await, await_macro, pin)]
2+
// run-pass
3+
// revisions: migrate mir
4+
//[mir]compile-flags: -Z borrowck=mir
45

56
trait Trait<'a, 'b> { }
67
impl<T> Trait<'_, '_> for T { }
Lines changed: 14 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,22 @@
1-
error: impl Trait captures unexpected lifetime
2-
--> $DIR/ordinary-bounds-pick-original.rs:11:50
1+
warning[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
2+
--> $DIR/ordinary-bounds-pick-original.rs:10:50
33
|
44
LL | fn upper_bounds<'a, 'b>(a: &'a u8, b: &'b u8) -> impl Trait<'a, 'b> {
5-
| ^^^^^^^^^^^^^^^^^^ only lifetimes that appear in the impl Trait bounds may be captured
5+
| ^^^^^^^^^^^^^^^^^^
66
|
7-
note: hidden type captures the lifetime 'a as defined on the function body at 11:17
8-
--> $DIR/ordinary-bounds-pick-original.rs:11:17
9-
|
10-
LL | fn upper_bounds<'a, 'b>(a: &'a u8, b: &'b u8) -> impl Trait<'a, 'b> {
11-
| ^^
12-
note: hidden type would be allowed to capture the lifetime 'a as defined on the function body at 11:17
13-
--> $DIR/ordinary-bounds-pick-original.rs:11:17
14-
|
15-
LL | fn upper_bounds<'a, 'b>(a: &'a u8, b: &'b u8) -> impl Trait<'a, 'b> {
16-
| ^^
17-
note: hidden type would be allowed to capture the lifetime 'b as defined on the function body at 11:21
18-
--> $DIR/ordinary-bounds-pick-original.rs:11:21
19-
|
20-
LL | fn upper_bounds<'a, 'b>(a: &'a u8, b: &'b u8) -> impl Trait<'a, 'b> {
21-
| ^^
22-
= note: hidden type would be allowed to capture the static lifetime
7+
= note: hidden type `(&u8, &u8)` captures lifetime '_#6r
8+
= warning: this error has been downgraded to a warning for backwards compatibility with previous releases
9+
= warning: this represents potential undefined behavior in your code and this warning will become a hard error in the future
10+
= note: for more information, try `rustc --explain E0729`
2311

24-
error: impl Trait captures unexpected lifetime
25-
--> $DIR/ordinary-bounds-pick-original.rs:11:50
12+
warning[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
13+
--> $DIR/ordinary-bounds-pick-original.rs:10:50
2614
|
2715
LL | fn upper_bounds<'a, 'b>(a: &'a u8, b: &'b u8) -> impl Trait<'a, 'b> {
28-
| ^^^^^^^^^^^^^^^^^^ only lifetimes that appear in the impl Trait bounds may be captured
29-
|
30-
note: hidden type captures the lifetime 'b as defined on the function body at 11:21
31-
--> $DIR/ordinary-bounds-pick-original.rs:11:21
16+
| ^^^^^^^^^^^^^^^^^^
3217
|
33-
LL | fn upper_bounds<'a, 'b>(a: &'a u8, b: &'b u8) -> impl Trait<'a, 'b> {
34-
| ^^
35-
note: hidden type would be allowed to capture the lifetime 'a as defined on the function body at 11:17
36-
--> $DIR/ordinary-bounds-pick-original.rs:11:17
37-
|
38-
LL | fn upper_bounds<'a, 'b>(a: &'a u8, b: &'b u8) -> impl Trait<'a, 'b> {
39-
| ^^
40-
note: hidden type would be allowed to capture the lifetime 'b as defined on the function body at 11:21
41-
--> $DIR/ordinary-bounds-pick-original.rs:11:21
42-
|
43-
LL | fn upper_bounds<'a, 'b>(a: &'a u8, b: &'b u8) -> impl Trait<'a, 'b> {
44-
| ^^
45-
= note: hidden type would be allowed to capture the static lifetime
46-
47-
error: aborting due to 2 previous errors
18+
= note: hidden type `(&u8, &u8)` captures lifetime '_#7r
19+
= warning: this error has been downgraded to a warning for backwards compatibility with previous releases
20+
= warning: this represents potential undefined behavior in your code and this warning will become a hard error in the future
21+
= note: for more information, try `rustc --explain E0729`
4822

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
warning[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
2+
--> $DIR/ordinary-bounds-pick-other.rs:19:74
3+
|
4+
LL | fn upper_bounds<'a, 'b, 'c, 'd, 'e>(a: Ordinary<'a>, b: Ordinary<'b>) -> impl Trait<'d, 'e>
5+
| ^^^^^^^^^^^^^^^^^^
6+
|
7+
= note: hidden type `Ordinary<'_>` captures lifetime '_#8r
8+
= warning: this error has been downgraded to a warning for backwards compatibility with previous releases
9+
= warning: this represents potential undefined behavior in your code and this warning will become a hard error in the future
10+
= note: for more information, try `rustc --explain E0729`
11+

src/test/ui/impl-trait/multiple-lifetimes/ordinary-bounds-pick-other.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// edition:2018
2-
3-
#![feature(arbitrary_self_types, async_await, await_macro, pin)]
2+
// run-pass
3+
// revisions: migrate mir
4+
//[mir]compile-flags: -Z borrowck=mir
45

56
trait Trait<'a, 'b> {}
67
impl<T> Trait<'_, '_> for T {}
Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,11 @@
1-
error: impl Trait captures unexpected lifetime
2-
--> $DIR/ordinary-bounds-pick-other.rs:18:74
1+
warning[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
2+
--> $DIR/ordinary-bounds-pick-other.rs:17:74
33
|
44
LL | fn upper_bounds<'a, 'b, 'c, 'd, 'e>(a: Ordinary<'a>, b: Ordinary<'b>) -> impl Trait<'d, 'e>
5-
| ^^^^^^^^^^^^^^^^^^ only lifetimes that appear in the impl Trait bounds may be captured
5+
| ^^^^^^^^^^^^^^^^^^
66
|
7-
note: hidden type captures the lifetime 'e as defined on the function body at 18:33
8-
--> $DIR/ordinary-bounds-pick-other.rs:18:33
9-
|
10-
LL | fn upper_bounds<'a, 'b, 'c, 'd, 'e>(a: Ordinary<'a>, b: Ordinary<'b>) -> impl Trait<'d, 'e>
11-
| ^^
12-
note: hidden type would be allowed to capture the lifetime 'd as defined on the function body at 18:29
13-
--> $DIR/ordinary-bounds-pick-other.rs:18:29
14-
|
15-
LL | fn upper_bounds<'a, 'b, 'c, 'd, 'e>(a: Ordinary<'a>, b: Ordinary<'b>) -> impl Trait<'d, 'e>
16-
| ^^
17-
note: hidden type would be allowed to capture the lifetime 'e as defined on the function body at 18:33
18-
--> $DIR/ordinary-bounds-pick-other.rs:18:33
19-
|
20-
LL | fn upper_bounds<'a, 'b, 'c, 'd, 'e>(a: Ordinary<'a>, b: Ordinary<'b>) -> impl Trait<'d, 'e>
21-
| ^^
22-
= note: hidden type would be allowed to capture the static lifetime
23-
24-
error: aborting due to previous error
7+
= note: hidden type `Ordinary<'_>` captures lifetime '_#8r
8+
= warning: this error has been downgraded to a warning for backwards compatibility with previous releases
9+
= warning: this represents potential undefined behavior in your code and this warning will become a hard error in the future
10+
= note: for more information, try `rustc --explain E0729`
2511

src/test/ui/impl-trait/multiple-lifetimes/ordinary-bounds-unrelated.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
// edition:2018
22

3-
#![feature(arbitrary_self_types, async_await, await_macro, pin)]
4-
53
trait Trait<'a, 'b> {}
64
impl<T> Trait<'_, '_> for T {}
75

0 commit comments

Comments
 (0)