-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Place related refactors #60486
Place related refactors #60486
Conversation
Place::Projection(proj) => place = &proj.base, | ||
Place::Base(PlaceBase::Static(_)) => return None, | ||
Place::Base(PlaceBase::Local(local)) => return Some(*local), | ||
} |
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.
There's one awful way to write this more compactly:
pub fn base_local(mut self: &Self) -> Option<Local> {
loop {
match self {
Place::Projection(proj) => self = &proj.base,
Place::Base(PlaceBase::Static(_)) => return None,
Place::Base(PlaceBase::Local(local)) => return Some(*local),
}
}
}
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.
I don't think it's really important. This code is going away at some point in the future where getting the base is just doing place.base
or in this case self.base
.
@bors r+ |
📌 Commit 49f0141 has been approved by |
… r=oli-obk Place related refactors Meanwhile I was working on Place 2 I'm finding some little things that I had on my branch but preferred to land a separate PR for things that are simpler to merge. r? @oli-obk
… r=oli-obk Place related refactors Meanwhile I was working on Place 2 I'm finding some little things that I had on my branch but preferred to land a separate PR for things that are simpler to merge. r? @oli-obk
… r=oli-obk Place related refactors Meanwhile I was working on Place 2 I'm finding some little things that I had on my branch but preferred to land a separate PR for things that are simpler to merge. r? @oli-obk
Rollup of 9 pull requests Successful merges: - #60429 (Account for paths in incorrect pub qualifier help) - #60449 (Constrain all regions in the concrete type for an opaque type) - #60486 (Place related refactors) - #60513 (Remove -Z borrowck=compare flag) - #60516 (Remove TypeckMir) - #60517 (Reword casting message) - #60520 (Add rustfmt toml) - #60521 (Migrate tidy to rust 2018 edition) - #60527 (Fix async fn lowering ICE with APIT.) Failed merges: r? @ghost
Meanwhile I was working on Place 2 I'm finding some little things that I had on my branch but preferred to land a separate PR for things that are simpler to merge.
r? @oli-obk