summaryrefslogtreecommitdiffstats
path: root/src/test/ui/type-alias-impl-trait/fallback.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui/type-alias-impl-trait/fallback.rs')
-rw-r--r--src/test/ui/type-alias-impl-trait/fallback.rs28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/test/ui/type-alias-impl-trait/fallback.rs b/src/test/ui/type-alias-impl-trait/fallback.rs
new file mode 100644
index 000000000..d8cf7d71f
--- /dev/null
+++ b/src/test/ui/type-alias-impl-trait/fallback.rs
@@ -0,0 +1,28 @@
+// Tests that we correctly handle opaque types being used opaquely,
+// even within their defining scope.
+//
+#![feature(type_alias_impl_trait)]
+
+type Foo = impl Copy;
+
+enum Wrapper<T> {
+ First(T),
+ Second
+}
+
+// This method constrains `Foo` to be `bool`
+fn constrained_foo() -> Foo {
+ true
+}
+
+
+// This method does not constrain `Foo`.
+// Per RFC 2071, function bodies may either
+// fully constrain an opaque type, or place no
+// constraints on it.
+fn unconstrained_foo() -> Wrapper<Foo> {
+ Wrapper::Second
+ //~^ ERROR: type annotations needed
+}
+
+fn main() {}