-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Nest the impl Trait
existential item inside the return type
#54741
Conversation
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
Nice! @bors r+ |
📌 Commit c3151c6 has been approved by |
☀️ Test successful - status-appveyor, status-travis |
/// | ||
/// The generic arg list are the lifetimes (and in the future possibly parameters) that are | ||
/// actually bound on the `impl Trait`. | ||
Def(ItemId, HirVec<GenericArg>), |
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.
I want something like this in general, maybe {...}
block syntax for types?
Then -> impl Trait
would be -> { existential type X: Trait; X }
.
cc @Centril @nikomatsakis
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.
In other words this would be legal?
type Foo = { u8 };
Not sure why it is useful tho...
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.
isn't that essentially generic modules? (but unnamed)
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.
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.
I guess only if you can depend on parameters in scope.
which impl trait always does
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.
@eddyb in exprs it exists for some sort of encapsulation purposes... I suppose you could do some sort of encapsulation of type aliases... but we should tread carefully here, there might be ambiguity in store.
PS: we should move this conversation elsewhere into a fresh issue / internals instead of comments on a merged PR (totally not discoverable...).
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.
I suppose you could do some sort of encapsulation of type aliases
Module-based encapsulation is how existential type X: Trait;
works today.
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.
@cramertj I meant something like this:
type Foo = {
type ComplexType = Bar<Baz<u8>>;
Vec<ComplexType>
};
fixes #54045
r? @cramertj