File tree Expand file tree Collapse file tree 2 files changed +56
-0
lines changed
tests/ui/traits/next-solver/opaques Expand file tree Collapse file tree 2 files changed +56
-0
lines changed Original file line number Diff line number Diff line change 1+ //@ compile-flags: -Znext-solver
2+
3+ // Test for https://github.com/rust-lang/trait-system-refactor-initiative/issues/235
4+
5+ // These are cases where the inner opaque types become "stranded" due to
6+ // errors of outer opaque types. Make sure we don't ICE in both cases.
7+
8+ use std:: future:: Future ;
9+
10+ fn foo ( ) -> impl ?Future < Output = impl Send > {
11+ //~^ ERROR: bound modifier `?` can only be applied to `Sized`
12+ //~| ERROR: bound modifier `?` can only be applied to `Sized`
13+ ( )
14+ }
15+
16+ trait Trait { }
17+ impl Trait for i32 { }
18+
19+ fn produce ( ) -> impl Trait < Assoc = impl Trait > {
20+ //~^ ERROR associated type `Assoc` not found for `Trait`
21+ //~| ERROR associated type `Assoc` not found for `Trait`
22+ 16
23+ }
24+
25+ fn main ( ) { }
Original file line number Diff line number Diff line change 1+ error: bound modifier `?` can only be applied to `Sized`
2+ --> $DIR/stranded_opaque.rs:10:18
3+ |
4+ LL | fn foo() -> impl ?Future<Output = impl Send> {
5+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
6+
7+ error[E0220]: associated type `Assoc` not found for `Trait`
8+ --> $DIR/stranded_opaque.rs:19:28
9+ |
10+ LL | fn produce() -> impl Trait<Assoc = impl Trait> {
11+ | ^^^^^ associated type `Assoc` not found
12+
13+ error: bound modifier `?` can only be applied to `Sized`
14+ --> $DIR/stranded_opaque.rs:10:18
15+ |
16+ LL | fn foo() -> impl ?Future<Output = impl Send> {
17+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
18+ |
19+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
20+
21+ error[E0220]: associated type `Assoc` not found for `Trait`
22+ --> $DIR/stranded_opaque.rs:19:28
23+ |
24+ LL | fn produce() -> impl Trait<Assoc = impl Trait> {
25+ | ^^^^^ associated type `Assoc` not found
26+ |
27+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
28+
29+ error: aborting due to 4 previous errors
30+
31+ For more information about this error, try `rustc --explain E0220`.
You can’t perform that action at this time.
0 commit comments