-
Notifications
You must be signed in to change notification settings - Fork 532
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update section on "existential type" to "opaque type" #402
Conversation
Ping @varkor there are some comments waiting for you |
aa21edd
to
5822f48
Compare
Addressed the comments. |
Thanks! |
express that type by using the opaque type in a "defining use site". | ||
|
||
```rust,ignore | ||
struct Struct; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't it be struct Foo;
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes it should! Feel free to open a PR with a fix :)
Edit: I misread. See comment below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then the whole example should be
fn foo() -> impl Bar {
struct Foo;
impl Bar for Foo { /* stuff */ }
Foo
}
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I misread earlier. Really, this code snippet should be read in the context of the previous one. But that's confusing, so maybe we should add the definition of Foo
here too. So the complete snippet would be:
type Foo = impl Bar;
struct Struct;
impl Bar for Struct { /* stuff */ }
fn foo() -> Foo {
Struct
}
Updates the guide as per the changes in rust-lang/rfcs#2515.