// Tests that we correctly handle the instantiated
// inference variable being completely unconstrained.
//
// check-pass
#![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
}

fn main() {}

// Tests that we correctly handle the instantiated
// inference variable being completely unconstrained.
//
// check-pass
#![feature(type_alias_impl_trait)]

type Foo = impl Copy;

enum Wrapper<T> {
    First(T),
    Second
}

fn _make_iter() -> Foo {
    true
}

fn _produce() -> Wrapper<Foo> {
    Wrapper::Second
}

fn main() {}

--- 
+++ 
@@ -11,11 +11,17 @@
     Second
 }
 
-fn _make_iter() -> Foo {
+// This method constrains `Foo` to be `bool`
+fn constrained_foo() -> Foo {
     true
 }
 
-fn _produce() -> Wrapper<Foo> {
+
+// 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
 }
 
Add explanation of unconstrained opaque type
