Add explanation of unconstrained opaque type

This commit is contained in:
Aaron Hill 2019-11-15 10:47:47 -05:00
parent 0e2ccaaa3e
commit 61c75bdb11
No known key found for this signature in database
GPG key ID: B4087E510E98B164

View file

@ -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
}