summaryrefslogtreecommitdiffstats
path: root/tests/ui/type-alias-impl-trait/impl-trait-in-type-alias-with-bad-substs.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/type-alias-impl-trait/impl-trait-in-type-alias-with-bad-substs.rs')
-rw-r--r--tests/ui/type-alias-impl-trait/impl-trait-in-type-alias-with-bad-substs.rs28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/ui/type-alias-impl-trait/impl-trait-in-type-alias-with-bad-substs.rs b/tests/ui/type-alias-impl-trait/impl-trait-in-type-alias-with-bad-substs.rs
new file mode 100644
index 000000000..a3f65146f
--- /dev/null
+++ b/tests/ui/type-alias-impl-trait/impl-trait-in-type-alias-with-bad-substs.rs
@@ -0,0 +1,28 @@
+#![feature(impl_trait_in_assoc_type)]
+
+// We weren't checking that the trait and impl generics line up in the
+// normalization-shortcut code in `OpaqueTypeCollector`.
+
+use std::ops::Deref;
+
+trait Foo {
+ type Bar<'a>;
+
+ type Baz<'a>;
+
+ fn test<'a>() -> Self::Bar<'a>;
+}
+
+impl Foo for () {
+ type Bar<'a> = impl Deref<Target = Self::Baz<'a>>;
+
+ type Baz<T> = impl Sized;
+ //~^ ERROR type `Baz` has 1 type parameter but its trait declaration has 0 type parameters
+ //~| ERROR unconstrained opaque type
+
+ fn test<'a>() -> Self::Bar<'a> {
+ &()
+ }
+}
+
+fn main() {}