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

fix: Don't show duplicated adjustment hints for blocks, ifs and matches #13749

Merged

Conversation

WaffleLapkin
Copy link
Member

@WaffleLapkin WaffleLapkin commented Dec 9, 2022

Before:
2022-12-09_21-10
After:
2022-12-09_21-22


I want to improve adjustment hints, this is the first step :)

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Dec 9, 2022
@rust-cloud-vms rust-cloud-vms bot force-pushed the remove_some_redudant_adjustment_hints branch from 0510d81 to 7c9a85b Compare December 9, 2022 18:45
@Veykril
Copy link
Member

Veykril commented Dec 9, 2022

Thanks!
@bors r+

@bors
Copy link
Collaborator

bors commented Dec 9, 2022

📌 Commit 7c9a85b has been approved by Veykril

It is now in the queue for this repository.

@bors
Copy link
Collaborator

bors commented Dec 9, 2022

⌛ Testing commit 7c9a85b with merge 1449204...

@bors
Copy link
Collaborator

bors commented Dec 9, 2022

☀️ Test successful - checks-actions
Approved by: Veykril
Pushing 1449204 to master...

@bors bors merged commit 1449204 into rust-lang:master Dec 9, 2022
@WaffleLapkin WaffleLapkin deleted the remove_some_redudant_adjustment_hints branch December 9, 2022 19:57
@jonas-schievink
Copy link
Contributor

Why are these coercions duplicated during type checking in the first place? To me that seems to be the better place to fix this.

@Veykril
Copy link
Member

Veykril commented Dec 14, 2022

Thinking about this a bit, I don't think they are duplicating actually? The reborrows happen on every "pass" between blocks/expressions (which I believe matches rustc's behaviour, but would need to double check). Though the hints on the else block are obviously wrong, due to how we handle those block constructs.

@WaffleLapkin
Copy link
Member Author

I don't think there is a meaningful difference between

  1. { expr /* coercion */ } /* coercion */
  2. { expr /* coercion */ }
  3. { expr } /* coercion */

They all result in the same "<type of expr> coerces to <type of the whole expr>" relationship, coercing the coercion does nothing I think.

@WaffleLapkin
Copy link
Member Author

For example in case of reborrows specifically I'm pretty sure &*&*a and &*a are the same. Because 'a <= '0 <= '1 and 'a <= '1 are equivalent.

bors added a commit that referenced this pull request Mar 14, 2023
fix: Only skip adjustment hints for block, if and match expressions for reborrows

cc #13749
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.

None yet

5 participants