Skip to content

Commit

Permalink
Add explanation of unconstrained opaque type
Browse files Browse the repository at this point in the history
  • Loading branch information
Aaron1011 committed Nov 18, 2019
1 parent 0e2ccaa commit 61c75bd
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/test/ui/type-alias-impl-trait/fallback.rs
Expand Up @@ -11,11 +11,17 @@ enum Wrapper<T> {
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
}

Expand Down

0 comments on commit 61c75bd

Please sign in to comment.