diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/ui/impl-trait/stranded-opaque.rs | 13 | ||||
| -rw-r--r-- | tests/ui/impl-trait/stranded-opaque.stderr | 9 |
2 files changed, 22 insertions, 0 deletions
diff --git a/tests/ui/impl-trait/stranded-opaque.rs b/tests/ui/impl-trait/stranded-opaque.rs new file mode 100644 index 00000000000..c7ab390e1fd --- /dev/null +++ b/tests/ui/impl-trait/stranded-opaque.rs @@ -0,0 +1,13 @@ +trait Trait {} + +impl Trait for i32 {} + +// Since `Assoc` doesn't actually exist, it's "stranded", and won't show up in +// the list of opaques that may be defined by the function. Make sure we don't +// ICE in this case. +fn produce<T>() -> impl Trait<Assoc = impl Trait> { + //~^ ERROR associated type `Assoc` not found for `Trait` + 16 +} + +fn main () {} diff --git a/tests/ui/impl-trait/stranded-opaque.stderr b/tests/ui/impl-trait/stranded-opaque.stderr new file mode 100644 index 00000000000..75f5480bc8b --- /dev/null +++ b/tests/ui/impl-trait/stranded-opaque.stderr @@ -0,0 +1,9 @@ +error[E0220]: associated type `Assoc` not found for `Trait` + --> $DIR/stranded-opaque.rs:8:31 + | +LL | fn produce<T>() -> impl Trait<Assoc = impl Trait> { + | ^^^^^ associated type `Assoc` not found + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0220`. |
