diff options
| author | lcnr <rust@lcnr.de> | 2025-02-21 10:24:11 +0100 |
|---|---|---|
| committer | lcnr <rust@lcnr.de> | 2025-02-28 12:16:47 +0100 |
| commit | fe874cd99bd4ed85e31144c9c359ac3f99dfa4cd (patch) | |
| tree | c5c974d665c9a7b2e781b3cbfa72a08b24717e71 | |
| parent | 7eb677e7eb4d7f8235d43e1b01669557fca80487 (diff) | |
| download | rust-fe874cd99bd4ed85e31144c9c359ac3f99dfa4cd.tar.gz rust-fe874cd99bd4ed85e31144c9c359ac3f99dfa4cd.zip | |
add test for newly supported behavior
2 files changed, 43 insertions, 0 deletions
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<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`. 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<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>>(); +} |
