Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add explanation of unconstrained opaque type
  • Loading branch information
Aaron1011 committed Nov 18, 2019
commit 61c75bdb11e782ee50ff1e4de6d29fd5ff4f0e31
10 changes: 8 additions & 2 deletions src/test/ui/type-alias-impl-trait/fallback.rs
Original file line number Diff line number Diff line change
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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure this entirely correct. What is the final type of Foo?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Final type is bool as determined by constrained_foo.

}

Expand Down