Skip to content
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

Merged
merged 1 commit into from
Oct 25, 2019

Conversation

ObsidianMinor
Copy link
Contributor

@ObsidianMinor ObsidianMinor commented Oct 24, 2019

Fixes #65642.

@rust-highfive
Copy link
Collaborator

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.

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Oct 24, 2019
@varkor
Copy link
Member

varkor commented Oct 24, 2019

Thanks, this looks great!

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Oct 24, 2019

📌 Commit 4cfcb77 has been approved by varkor

@bors
Copy link
Contributor

bors commented Oct 24, 2019

🌲 The tree is currently closed for pull requests below priority 1000, this pull request will be tested once the tree is reopened

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Oct 24, 2019
@@ -228,14 +227,28 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
});

if explicit && impl_trait {
let spans =
seg.generic_args().args
Copy link
Contributor

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?

Copy link
Contributor

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.

Copy link
Member

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.

Copy link
Contributor

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!

Centril added a commit to Centril/rust that referenced this pull request Oct 25, 2019
Changed APIT with explicit generic args span to specific arg spans

Fixes rust-lang#65642.
bors added a commit that referenced this pull request Oct 25, 2019
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
@bors bors merged commit 4cfcb77 into rust-lang:master Oct 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve span for "cannot provide explicit generic arguments when impl Trait is used in argument position"
6 participants