add test for newly supported behavior

This commit is contained in:
lcnr 2025-02-21 10:24:11 +01:00
parent 7eb677e7eb
commit fe874cd99b
2 changed files with 43 additions and 0 deletions

View File

@ -0,0 +1,17 @@
error[E0275]: overflow evaluating the requirement `Foo<T>: SendIndir`
--> $DIR/only-one-coinductive-step-needed.rs:9:15
|
LL | struct Foo<T>(<Foo<T> as Trait>::Assoc);
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
note: required for `Foo<T>` to implement `Trait`
--> $DIR/only-one-coinductive-step-needed.rs:18:20
|
LL | impl<T: SendIndir> Trait for T {
| --------- ^^^^^ ^
| |
| unsatisfied trait bound introduced here
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0275`.

View File

@ -0,0 +1,26 @@
//@ revisions: current next
//@ ignore-compare-mode-next-solver (explicit revisions)
//@[next] compile-flags: -Znext-solver
//@[next] check-pass
// #136824 changed cycles to be coinductive if they have at least
// one productive step, causing this test to pass with the new solver.
struct Foo<T>(<Foo<T> as Trait>::Assoc);
//[current]~^ ERROR overflow evaluating the requirement `Foo<T>: SendIndir`
trait SendIndir {}
impl<T: Send> SendIndir for T {}
trait Trait {
type Assoc;
}
impl<T: SendIndir> Trait for T {
type Assoc = ();
}
fn is_send<T: Send>() {}
fn main() {
is_send::<Foo<u32>>();
}