-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
error[E0632]: cannot provide explicit generic arguments when `impl Trait` is used in argument position | ||
--> $DIR/universal-issue-48703.rs:8:5 | ||
--> $DIR/universal-issue-48703.rs:8:11 | ||
| | ||
LL | foo::<String>('a'); | ||
| ^^^^^^^^^^^^^ | ||
| ^^^^^^ explicit generic argument not allowed | ||
|
||
error: aborting due to previous error | ||
|
6 changes: 4 additions & 2 deletions
6
src/test/ui/impl-trait/issues/universal-turbofish-in-method-issue-50950.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
error[E0632]: cannot provide explicit generic arguments when `impl Trait` is used in argument position | ||
--> $DIR/universal-turbofish-in-method-issue-50950.rs:14:9 | ||
--> $DIR/universal-turbofish-in-method-issue-50950.rs:14:24 | ||
| | ||
LL | evt.handle_event::<TestEvent, fn(TestEvent)>(|_evt| { | ||
| ^^^^^^^^^^^^ | ||
| ^^^^^^^^^ ^^^^^^^^^^^^^ explicit generic argument not allowed | ||
| | | ||
| explicit generic argument not allowed | ||
|
||
error: aborting due to previous error | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,20 @@ | ||
error[E0632]: cannot provide explicit generic arguments when `impl Trait` is used in argument position | ||
--> $DIR/synthetic-param.rs:20:5 | ||
--> $DIR/synthetic-param.rs:20:12 | ||
| | ||
LL | func::<u8>(42); | ||
| ^^^^^^^^^^ | ||
| ^^ explicit generic argument not allowed | ||
|
||
error[E0632]: cannot provide explicit generic arguments when `impl Trait` is used in argument position | ||
--> $DIR/synthetic-param.rs:23:5 | ||
--> $DIR/synthetic-param.rs:23:17 | ||
| | ||
LL | Foo::func::<u8>(42); | ||
| ^^^^^^^^^^^^^^^ | ||
| ^^ explicit generic argument not allowed | ||
|
||
error[E0632]: cannot provide explicit generic arguments when `impl Trait` is used in argument position | ||
--> $DIR/synthetic-param.rs:26:5 | ||
--> $DIR/synthetic-param.rs:26:23 | ||
| | ||
LL | Bar::<i8>::func::<u8>(42); | ||
| ^^^^^^^^^^^^^^^^^^^^^ | ||
| ^^ explicit generic argument not allowed | ||
|
||
error: aborting due to 3 previous errors | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 animpl 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!