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

Use the power of adding helper function to simplify code w/ Mutability #104786

Merged
merged 9 commits into from
Nov 26, 2022

Conversation

WaffleLapkin
Copy link
Member

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Nov 23, 2022
@rustbot
Copy link
Collaborator

rustbot commented Nov 23, 2022

Some changes occurred in need_type_info.rs

cc @lcnr

@rustbot
Copy link
Collaborator

rustbot commented Nov 23, 2022

Some changes occurred in compiler/rustc_codegen_cranelift

cc @bjorn3

@WaffleLapkin WaffleLapkin marked this pull request as draft November 23, 2022 18:37
@rust-cloud-vms rust-cloud-vms bot force-pushed the amp-mut-help branch 3 times, most recently from 4a05732 to 7d555e1 Compare November 23, 2022 19:35
@WaffleLapkin WaffleLapkin marked this pull request as ready for review November 23, 2022 19:41
@compiler-errors
Copy link
Member

I'm fine with these changes, but I think that Mutability::choice (6d53a3bb496ae36b20fb668c3252596ba6795bce) is a bit too clever -- I think it's more readable with an inline match.

@WaffleLapkin
Copy link
Member Author

@compiler-errors I do think that it's much nicer that way, matching tends to be too verbose IMO. But I can revert that commit.

@compiler-errors
Copy link
Member

I'd prefer if you did -- since it's only used in a handful of places, I'm not convinced it's as much of an ergonomic improvement compared to the other improvements in this commit stack.

Comment on lines 1784 to 1787
TyKind::Rptr(_, mt) if mt.ty.kind.is_implicit_self() && mt.mutbl.is_mut() => {
hir::ImplicitSelfKind::MutRef
}
TyKind::Rptr(_, mt) if mt.ty.kind.is_implicit_self() => {
Copy link
Member

@compiler-errors compiler-errors Nov 23, 2022

Choose a reason for hiding this comment

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

Can you match or if on mt.mutbl here instead of doing this in two arms?

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

@compiler-errors
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Nov 25, 2022

📌 Commit e143fa2 has been approved by compiler-errors

It is now in the queue for this repository.

@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 Nov 25, 2022
bors added a commit to rust-lang-ci/rust that referenced this pull request Nov 26, 2022
…llaumeGomez

Rollup of 7 pull requests

Successful merges:

 - rust-lang#104786 (Use the power of adding helper function to simplify code w/ `Mutability`)
 - rust-lang#104788 (Do not record unresolved const vars in generator interior)
 - rust-lang#104909 (Rename `normalize_opaque_types` to `reveal_opaque_types_in_bounds`)
 - rust-lang#104921 (Remove unnecessary binder from `get_impl_future_output_ty`)
 - rust-lang#104924 (jsondoclint: Accept trait alias is places where trait expected.)
 - rust-lang#104928 (rustdoc: use flexbox CSS to align sidebar button instead of position)
 - rust-lang#104943 (jsondoclint: Handle using enum variants and glob using enums.)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit a2e485c into rust-lang:master Nov 26, 2022
@rustbot rustbot added this to the 1.67.0 milestone Nov 26, 2022
@WaffleLapkin WaffleLapkin deleted the amp-mut-help branch November 27, 2022 07:14
bjorn3 pushed a commit to bjorn3/rust that referenced this pull request Dec 14, 2022
…ler-errors

Use the power of adding helper function to simplify code w/ `Mutability`

r? `@compiler-errors`
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. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants