Skip to content

Add edition checks for some tests that had divergent output #142255

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 26, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions tests/ui/coroutine/auto-trait-regions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,31 +23,31 @@ fn assert_foo<T: Foo>(f: T) {}
fn main() {
// Make sure 'static is erased for coroutine interiors so we can't match it in trait selection
let x: &'static _ = &OnlyFooIfStaticRef(No);
let gen = #[coroutine] move || {
let generator = #[coroutine] move || {
let x = x;
yield;
assert_foo(x);
};
assert_foo(gen);
assert_foo(generator);
//~^ ERROR implementation of `Foo` is not general enough

// Allow impls which matches any lifetime
let x = &OnlyFooIfRef(No);
let gen = #[coroutine] move || {
let generator = #[coroutine] move || {
let x = x;
yield;
assert_foo(x);
};
assert_foo(gen); // ok
assert_foo(generator); // ok

// Disallow impls which relates lifetimes in the coroutine interior
let gen = #[coroutine] move || {
let generator = #[coroutine] move || {
let a = A(&mut true, &mut true, No);
//~^ ERROR borrow may still be in use when coroutine yields
//~| ERROR borrow may still be in use when coroutine yields
yield;
assert_foo(a);
};
assert_foo(gen);
assert_foo(generator);
//~^ ERROR not general enough
}
24 changes: 12 additions & 12 deletions tests/ui/coroutine/auto-trait-regions.stderr
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
error[E0626]: borrow may still be in use when coroutine yields
--> $DIR/auto-trait-regions.rs:45:19
|
LL | let gen = #[coroutine] move || {
| ------- within this coroutine
LL | let generator = #[coroutine] move || {
| ------- within this coroutine
LL | let a = A(&mut true, &mut true, No);
| ^^^^^^^^^
...
Expand All @@ -11,14 +11,14 @@ LL | yield;
|
help: add `static` to mark this coroutine as unmovable
|
LL | let gen = #[coroutine] static move || {
| ++++++
LL | let generator = #[coroutine] static move || {
| ++++++

error[E0626]: borrow may still be in use when coroutine yields
--> $DIR/auto-trait-regions.rs:45:30
|
LL | let gen = #[coroutine] move || {
| ------- within this coroutine
LL | let generator = #[coroutine] move || {
| ------- within this coroutine
LL | let a = A(&mut true, &mut true, No);
| ^^^^^^^^^
...
Expand All @@ -27,23 +27,23 @@ LL | yield;
|
help: add `static` to mark this coroutine as unmovable
|
LL | let gen = #[coroutine] static move || {
| ++++++
LL | let generator = #[coroutine] static move || {
| ++++++

error: implementation of `Foo` is not general enough
--> $DIR/auto-trait-regions.rs:31:5
|
LL | assert_foo(gen);
| ^^^^^^^^^^^^^^^ implementation of `Foo` is not general enough
LL | assert_foo(generator);
| ^^^^^^^^^^^^^^^^^^^^^ implementation of `Foo` is not general enough
|
= note: `&'0 OnlyFooIfStaticRef` must implement `Foo`, for any lifetime `'0`...
= note: ...but `Foo` is actually implemented for the type `&'static OnlyFooIfStaticRef`

error: implementation of `Foo` is not general enough
--> $DIR/auto-trait-regions.rs:51:5
|
LL | assert_foo(gen);
| ^^^^^^^^^^^^^^^ implementation of `Foo` is not general enough
LL | assert_foo(generator);
| ^^^^^^^^^^^^^^^^^^^^^ implementation of `Foo` is not general enough
|
= note: `Foo` would have to be implemented for the type `A<'0, '1>`, for any two lifetimes `'0` and `'1`...
= note: ...but `Foo` is actually implemented for the type `A<'_, '2>`, for some specific lifetime `'2`
Expand Down
6 changes: 3 additions & 3 deletions tests/ui/coroutine/clone-impl-static.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
#![feature(coroutines, coroutine_clone, stmt_expr_attributes)]

fn main() {
let gen = #[coroutine]
let generator = #[coroutine]
static move || {
yield;
};
check_copy(&gen);
check_copy(&generator);
//~^ ERROR Copy` is not satisfied
check_clone(&gen);
check_clone(&generator);
//~^ ERROR Clone` is not satisfied
}

Expand Down
8 changes: 4 additions & 4 deletions tests/ui/coroutine/clone-impl-static.stderr
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
error[E0277]: the trait bound `{static coroutine@$DIR/clone-impl-static.rs:11:5: 11:19}: Copy` is not satisfied
--> $DIR/clone-impl-static.rs:14:16
|
LL | check_copy(&gen);
| ---------- ^^^^ the trait `Copy` is not implemented for `{static coroutine@$DIR/clone-impl-static.rs:11:5: 11:19}`
LL | check_copy(&generator);
| ---------- ^^^^^^^^^^ the trait `Copy` is not implemented for `{static coroutine@$DIR/clone-impl-static.rs:11:5: 11:19}`
| |
| required by a bound introduced by this call
|
Expand All @@ -15,8 +15,8 @@ LL | fn check_copy<T: Copy>(_x: &T) {}
error[E0277]: the trait bound `{static coroutine@$DIR/clone-impl-static.rs:11:5: 11:19}: Clone` is not satisfied
--> $DIR/clone-impl-static.rs:16:17
|
LL | check_clone(&gen);
| ----------- ^^^^ the trait `Clone` is not implemented for `{static coroutine@$DIR/clone-impl-static.rs:11:5: 11:19}`
LL | check_clone(&generator);
| ----------- ^^^^^^^^^^ the trait `Clone` is not implemented for `{static coroutine@$DIR/clone-impl-static.rs:11:5: 11:19}`
| |
| required by a bound introduced by this call
|
Expand Down
Loading
Loading