This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +48
-0
lines changed
tests/ui/traits/next-solver/cycles/coinduction Expand file tree Collapse file tree 2 files changed +48
-0
lines changed Original file line number Diff line number Diff line change
1
+ error[E0275]: overflow evaluating the requirement `u32: SendIndir<Foo<u32>>`
2
+ --> $DIR/only-one-coinductive-step-needed-trait.rs:24:5
3
+ |
4
+ LL | is_send::<Foo<u32>>();
5
+ | ^^^^^^^^^^^^^^^^^^^^^
6
+ |
7
+ note: required for `Foo<u32>` to implement `Send`
8
+ --> $DIR/only-one-coinductive-step-needed-trait.rs:17:35
9
+ |
10
+ LL | unsafe impl<T: SendIndir<Foo<T>>> Send for Foo<T> {}
11
+ | ----------------- ^^^^ ^^^^^^
12
+ | |
13
+ | unsatisfied trait bound introduced here
14
+ note: required by a bound in `is_send`
15
+ --> $DIR/only-one-coinductive-step-needed-trait.rs:22:15
16
+ |
17
+ LL | fn is_send<T: Send>() {}
18
+ | ^^^^ required by this bound in `is_send`
19
+
20
+ error: aborting due to 1 previous error
21
+
22
+ For more information about this error, try `rustc --explain E0275`.
Original file line number Diff line number Diff line change
1
+ //@ revisions: current next
2
+ //@ ignore-compare-mode-next-solver (explicit revisions)
3
+ //@[next] compile-flags: -Znext-solver
4
+ //@[next] check-pass
5
+
6
+ // #136824 changed cycles to be coinductive if they have at least
7
+ // one productive step, causing this test to pass with the new solver.
8
+ //
9
+ // The cycle in the test is the following:
10
+ // - `Foo<T>: Send`, impl requires
11
+ // - `T: SendIndir<Foo<T>>`, impl requires
12
+ // - `Foo<T>: Send` cycle
13
+ //
14
+ // The old solver treats this cycle as inductive due to the `T: SendIndir` step.
15
+
16
+ struct Foo < T > ( T ) ;
17
+ unsafe impl < T : SendIndir < Foo < T > > > Send for Foo < T > { }
18
+
19
+ trait SendIndir < T > { }
20
+ impl < T , U : Send > SendIndir < U > for T { }
21
+
22
+ fn is_send < T : Send > ( ) { }
23
+ fn main ( ) {
24
+ is_send :: < Foo < u32 > > ( ) ;
25
+ //[current]~^ ERROR overflow evaluating the requirement `u32: SendIndir<Foo<u32>>`
26
+ }
You can’t perform that action at this time.
0 commit comments