]> git.lizzy.rs Git - rust.git/commitdiff
Add a regression test for issue-74244
authorYuki Okushi <huyuumi.dev@gmail.com>
Thu, 1 Oct 2020 05:10:44 +0000 (14:10 +0900)
committerYuki Okushi <huyuumi.dev@gmail.com>
Thu, 1 Oct 2020 05:10:44 +0000 (14:10 +0900)
src/test/ui/type-alias-impl-trait/issue-74244.rs [new file with mode: 0644]
src/test/ui/type-alias-impl-trait/issue-74244.stderr [new file with mode: 0644]

diff --git a/src/test/ui/type-alias-impl-trait/issue-74244.rs b/src/test/ui/type-alias-impl-trait/issue-74244.rs
new file mode 100644 (file)
index 0000000..bb4104b
--- /dev/null
@@ -0,0 +1,20 @@
+#![feature(type_alias_impl_trait)]
+
+trait Allocator {
+    type Buffer;
+}
+
+struct DefaultAllocator;
+
+impl<T> Allocator for DefaultAllocator {
+    //~^ ERROR: the type parameter `T` is not constrained
+    type Buffer = ();
+}
+
+type A = impl Fn(<DefaultAllocator as Allocator>::Buffer);
+
+fn foo() -> A {
+    |_| ()
+}
+
+fn main() {}
diff --git a/src/test/ui/type-alias-impl-trait/issue-74244.stderr b/src/test/ui/type-alias-impl-trait/issue-74244.stderr
new file mode 100644 (file)
index 0000000..ff6bacd
--- /dev/null
@@ -0,0 +1,9 @@
+error[E0207]: the type parameter `T` is not constrained by the impl trait, self type, or predicates
+  --> $DIR/issue-74244.rs:9:6
+   |
+LL | impl<T> Allocator for DefaultAllocator {
+   |      ^ unconstrained type parameter
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0207`.