-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Error on nested impl Trait and path projections from impl Trait #48084
Conversation
6c61a5c
to
a7aabd3
Compare
☔ The latest upstream changes (presumably #47843) made this pull request unmergeable. Please resolve the merge conflicts. |
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.
New test, new error message, but seems good
for type_binding in ¶ms.bindings { | ||
// Type bindings such as `Item=impl Debug` in `Iterator<Item=Debug>` | ||
// are allowed to contain nested `impl Trait`. | ||
self.with_impl_trait(None, |this| visit::walk_ty(this, &type_binding.ty)); |
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 think this code would permit this
<dyn Iterator<Item = impl Debug> as Iterator>::Item
which ought not to be allowed
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.
Oh, probably not, because that is handled by a totally distinct visitor, I see
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.
Can you add a test for it, anyway?
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.
Done.
struct_span_err!(self.session, t.span, E0666, | ||
"nested `impl Trait` is not allowed") | ||
.span_label(outer_impl_trait, "outer `impl Trait`") | ||
.span_label(t.span, "devilishly nested `impl Trait` here") |
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 don't "devilishly" should be in our error message
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.
No love for the E0666 easter egg 😢
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.
Done.
a7aabd3
to
dbacf0c
Compare
Travis is unhappy: https://travis-ci.org/rust-lang/rust/builds/341238329#L1665-L1686 The |
r=me once travis is happy |
@bors r=nikomatsakis |
📌 Commit 9e9c55f has been approved by |
…atsakis Error on nested impl Trait and path projections from impl Trait cc rust-lang#34511 r? @nikomatsakis
…atsakis Fixes rust-lang#47311. r? @nrc
…atsakis Error on nested impl Trait and path projections from impl Trait cc rust-lang#34511 r? @nikomatsakis
…atsakis Error on nested impl Trait and path projections from impl Trait cc rust-lang#34511 r? @nikomatsakis
cc #34511
r? @nikomatsakis