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

[impl_trait_in_params]: avoid ICE when function with impl Trait type has no parameters #11804

Merged
merged 1 commit into from Nov 15, 2023

Conversation

y21
Copy link
Member

@y21 y21 commented Nov 14, 2023

Fixes #11803

If I'm reading the old code correctly, it was taking the span of the first parameter (without checking that it exists, which caused the ICE) and uses that to figure out where the generic parameter to insert should go (cc @blyxyas you wrote the lint, is that correct?).
This seemed equivalent to just generics.span, which doesn't require calculating the spans like that and simplifies it a fair bit

changelog: don't ICE when function has no parameters but generics have an impl Trait type

@rustbot
Copy link
Collaborator

rustbot commented Nov 14, 2023

r? @dswij

(rustbot has picked a reviewer for you, use r? to override)

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Nov 14, 2023
@blyxyas
Copy link
Member

blyxyas commented Nov 14, 2023

Oh I didn't take into account weird generics like those (>ω<。) This gets the silly seal of approval from me 👍

Copy link
Member

@dswij dswij left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice

@dswij
Copy link
Member

dswij commented Nov 15, 2023

Thank you!

@bors r+

@bors
Copy link
Collaborator

bors commented Nov 15, 2023

📌 Commit 3f6b29a has been approved by dswij

It is now in the queue for this repository.

@bors
Copy link
Collaborator

bors commented Nov 15, 2023

⌛ Testing commit 3f6b29a with merge 783b914...

@bors
Copy link
Collaborator

bors commented Nov 15, 2023

☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test
Approved by: dswij
Pushing 783b914 to master...

@bors bors merged commit 783b914 into rust-lang:master Nov 15, 2023
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ICE: impl_trait_in_params.rs index out of bounds: the len is 0 but the index is 0
5 participants