Skip to content

Commit 6ddf1d2

Browse files
committed
Revise the tests for coroutine/auto-trait-regions
1 parent 293294e commit 6ddf1d2

File tree

4 files changed

+25
-25
lines changed

4 files changed

+25
-25
lines changed

tests/ui/async-await/higher-ranked-auto-trait-13.assumptions.stderr

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ error: implementation of `Getter` is not general enough
44
LL | assert_send(my_send_async_method(struct_with_lifetime, data));
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ implementation of `Getter` is not general enough
66
|
7-
= note: `Getter<'1>` would have to be implemented for the type `GetterImpl<'0, ConstructableImpl<'_>>`, for any two lifetimes `'0` and `'1`...
7+
= note: `Getter<'_>` would have to be implemented for the type `GetterImpl<'0, ConstructableImpl<'1>>`, for any two lifetimes `'0` and `'1`...
88
= note: ...but `Getter<'2>` is actually implemented for the type `GetterImpl<'2, ConstructableImpl<'_>>`, for some specific lifetime `'2`
99

1010
error: implementation of `Getter` is not general enough
@@ -15,15 +15,14 @@ LL | assert_send(my_send_async_method(struct_with_lifetime, data));
1515
|
1616
= note: `Getter<'1>` would have to be implemented for the type `GetterImpl<'0, ConstructableImpl<'_>>`, for any two lifetimes `'0` and `'1`...
1717
= note: ...but `Getter<'2>` is actually implemented for the type `GetterImpl<'2, ConstructableImpl<'_>>`, for some specific lifetime `'2`
18-
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
1918

2019
error: implementation of `Getter` is not general enough
2120
--> $DIR/higher-ranked-auto-trait-13.rs:65:5
2221
|
2322
LL | assert_send(my_send_async_method(struct_with_lifetime, data));
2423
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ implementation of `Getter` is not general enough
2524
|
26-
= note: `Getter<'1>` would have to be implemented for the type `GetterImpl<'0, ConstructableImpl<'_>>`, for any two lifetimes `'0` and `'1`...
25+
= note: `Getter<'_>` would have to be implemented for the type `GetterImpl<'0, ConstructableImpl<'1>>`, for any two lifetimes `'0` and `'1`...
2726
= note: ...but `Getter<'2>` is actually implemented for the type `GetterImpl<'2, ConstructableImpl<'_>>`, for some specific lifetime `'2`
2827
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
2928

tests/ui/async-await/higher-ranked-auto-trait-13.no_assumptions.stderr

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ error: implementation of `Getter` is not general enough
44
LL | assert_send(my_send_async_method(struct_with_lifetime, data));
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ implementation of `Getter` is not general enough
66
|
7-
= note: `Getter<'1>` would have to be implemented for the type `GetterImpl<'0, ConstructableImpl<'_>>`, for any two lifetimes `'0` and `'1`...
7+
= note: `Getter<'_>` would have to be implemented for the type `GetterImpl<'0, ConstructableImpl<'1>>`, for any two lifetimes `'0` and `'1`...
88
= note: ...but `Getter<'2>` is actually implemented for the type `GetterImpl<'2, ConstructableImpl<'_>>`, for some specific lifetime `'2`
99

1010
error: implementation of `Getter` is not general enough
@@ -15,7 +15,6 @@ LL | assert_send(my_send_async_method(struct_with_lifetime, data));
1515
|
1616
= note: `Getter<'1>` would have to be implemented for the type `GetterImpl<'0, ConstructableImpl<'_>>`, for any two lifetimes `'0` and `'1`...
1717
= note: ...but `Getter<'2>` is actually implemented for the type `GetterImpl<'2, ConstructableImpl<'_>>`, for some specific lifetime `'2`
18-
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
1918

2019
error: implementation of `Callable` is not general enough
2120
--> $DIR/higher-ranked-auto-trait-13.rs:65:5
@@ -32,7 +31,7 @@ error: implementation of `Getter` is not general enough
3231
LL | assert_send(my_send_async_method(struct_with_lifetime, data));
3332
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ implementation of `Getter` is not general enough
3433
|
35-
= note: `Getter<'1>` would have to be implemented for the type `GetterImpl<'0, ConstructableImpl<'_>>`, for any two lifetimes `'0` and `'1`...
34+
= note: `Getter<'_>` would have to be implemented for the type `GetterImpl<'0, ConstructableImpl<'1>>`, for any two lifetimes `'0` and `'1`...
3635
= note: ...but `Getter<'2>` is actually implemented for the type `GetterImpl<'2, ConstructableImpl<'_>>`, for some specific lifetime `'2`
3736
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
3837

tests/ui/coroutine/auto-trait-regions.rs

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,19 @@ impl<'a> Foo for &'a OnlyFooIfRef {}
2020

2121
fn assert_foo<T: Foo>(f: T) {}
2222

23+
fn other_assertion() {
24+
// Disallow impls which relates lifetimes in the coroutine interior
25+
let generator = #[coroutine] move || {
26+
let a = A(&mut true, &mut true, No);
27+
//~^ ERROR borrow may still be in use when coroutine yields
28+
//~| ERROR borrow may still be in use when coroutine yields
29+
yield;
30+
assert_foo(a);
31+
};
32+
assert_foo(generator);
33+
//~^ ERROR not general enough
34+
}
35+
2336
fn main() {
2437
// Make sure 'static is erased for coroutine interiors so we can't match it in trait selection
2538
let x: &'static _ = &OnlyFooIfStaticRef(No);
@@ -39,15 +52,4 @@ fn main() {
3952
assert_foo(x);
4053
};
4154
assert_foo(generator); // ok
42-
43-
// Disallow impls which relates lifetimes in the coroutine interior
44-
let generator = #[coroutine] move || {
45-
let a = A(&mut true, &mut true, No);
46-
//~^ ERROR borrow may still be in use when coroutine yields
47-
//~| ERROR borrow may still be in use when coroutine yields
48-
yield;
49-
assert_foo(a);
50-
};
51-
assert_foo(generator);
52-
//~^ ERROR not general enough
5355
}

tests/ui/coroutine/auto-trait-regions.stderr

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0626]: borrow may still be in use when coroutine yields
2-
--> $DIR/auto-trait-regions.rs:45:19
2+
--> $DIR/auto-trait-regions.rs:26:19
33
|
44
LL | let generator = #[coroutine] move || {
55
| ------- within this coroutine
@@ -15,7 +15,7 @@ LL | let generator = #[coroutine] static move || {
1515
| ++++++
1616

1717
error[E0626]: borrow may still be in use when coroutine yields
18-
--> $DIR/auto-trait-regions.rs:45:30
18+
--> $DIR/auto-trait-regions.rs:26:30
1919
|
2020
LL | let generator = #[coroutine] move || {
2121
| ------- within this coroutine
@@ -31,22 +31,22 @@ LL | let generator = #[coroutine] static move || {
3131
| ++++++
3232

3333
error: implementation of `Foo` is not general enough
34-
--> $DIR/auto-trait-regions.rs:31:5
34+
--> $DIR/auto-trait-regions.rs:32:5
3535
|
3636
LL | assert_foo(generator);
3737
| ^^^^^^^^^^^^^^^^^^^^^ implementation of `Foo` is not general enough
3838
|
39-
= note: `&'0 OnlyFooIfStaticRef` must implement `Foo`, for any lifetime `'0`...
40-
= note: ...but `Foo` is actually implemented for the type `&'static OnlyFooIfStaticRef`
39+
= note: `Foo` would have to be implemented for the type `A<'0, '1>`, for any two lifetimes `'0` and `'1`...
40+
= note: ...but `Foo` is actually implemented for the type `A<'_, '2>`, for some specific lifetime `'2`
4141

4242
error: implementation of `Foo` is not general enough
43-
--> $DIR/auto-trait-regions.rs:51:5
43+
--> $DIR/auto-trait-regions.rs:44:5
4444
|
4545
LL | assert_foo(generator);
4646
| ^^^^^^^^^^^^^^^^^^^^^ implementation of `Foo` is not general enough
4747
|
48-
= note: `Foo` would have to be implemented for the type `A<'0, '1>`, for any two lifetimes `'0` and `'1`...
49-
= note: ...but `Foo` is actually implemented for the type `A<'_, '2>`, for some specific lifetime `'2`
48+
= note: `&'0 OnlyFooIfStaticRef` must implement `Foo`, for any lifetime `'0`...
49+
= note: ...but `Foo` is actually implemented for the type `&'static OnlyFooIfStaticRef`
5050

5151
error: aborting due to 4 previous errors
5252

0 commit comments

Comments
 (0)