diff --git a/tests/ui/traits/next-solver/cycles/coinduction/only-one-coinductive-step-needed.current.stderr b/tests/ui/traits/next-solver/cycles/coinduction/only-one-coinductive-step-needed.current.stderr new file mode 100644 index 00000000000..5e8e2ece54d --- /dev/null +++ b/tests/ui/traits/next-solver/cycles/coinduction/only-one-coinductive-step-needed.current.stderr @@ -0,0 +1,17 @@ +error[E0275]: overflow evaluating the requirement `Foo: SendIndir` + --> $DIR/only-one-coinductive-step-needed.rs:9:15 + | +LL | struct Foo( as Trait>::Assoc); + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | +note: required for `Foo` to implement `Trait` + --> $DIR/only-one-coinductive-step-needed.rs:18:20 + | +LL | impl 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`. diff --git a/tests/ui/traits/next-solver/cycles/coinduction/only-one-coinductive-step-needed.rs b/tests/ui/traits/next-solver/cycles/coinduction/only-one-coinductive-step-needed.rs new file mode 100644 index 00000000000..c73189fbb08 --- /dev/null +++ b/tests/ui/traits/next-solver/cycles/coinduction/only-one-coinductive-step-needed.rs @@ -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( as Trait>::Assoc); +//[current]~^ ERROR overflow evaluating the requirement `Foo: SendIndir` + +trait SendIndir {} +impl SendIndir for T {} + +trait Trait { + type Assoc; +} +impl Trait for T { + type Assoc = (); +} + +fn is_send() {} + +fn main() { + is_send::>(); +}