-
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
Changed APIT with explicit generic args span to specific arg spans #65763
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @zackmdavis (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
Thanks, this looks great! @bors r+ rollup |
📌 Commit 4cfcb77 has been approved by |
🌲 The tree is currently closed for pull requests below priority 1000, this pull request will be tested once the tree is reopened |
@@ -228,14 +227,28 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o { | |||
}); | |||
|
|||
if explicit && impl_trait { | |||
let spans = | |||
seg.generic_args().args |
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.
This may come from my lack of understanding of what exactly there error is here, but would it be possible that we'd want to mark some of these spans and not others?
That is, above, we check if any of the generic args match some condition, but we don't perform a similar check here. I'm not sure I could construct an example, but could it ever be the case that only a subset of these generic parameters was violating the condition we're checking for above?
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.
When I looked at tackling this, I was going to keep track of the indices which matched the pattern above, and then use those same indices to grab the spans in the same way you did 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.
This error is emitted when we have an impl Trait
argument, which generates an implicit generic type parameter, and then we try to provide explicit generic arguments — that is, we can't provide any explicit arguments to something that takes an impl Trait
argument. In that case, it's correct to highlight every single argument, as all of them are offending.
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.
Ahh, ok, that makes sense! Thanks for explaining!
Changed APIT with explicit generic args span to specific arg spans Fixes rust-lang#65642.
Rollup of 9 pull requests Successful merges: - #62959 (Add by-value iterator for arrays ) - #65390 (Add long error explanation for E0576) - #65408 (reorder config.toml.example options and add one missing option) - #65414 (ignore uninhabited non-exhaustive variant fields) - #65666 (Deprecated proc_macro doesn't trigger warning on build library) - #65742 (Pre-expansion gate most of the things) - #65747 (Adjust the tracking issue for `untagged_unions`.) - #65763 (Changed APIT with explicit generic args span to specific arg spans) - #65775 (Fix more `ReEmpty` ICEs) Failed merges: - #65519 (trait-based structural match implementation) r? @ghost
Fixes #65642.