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

Place related refactors #60486

Merged
merged 3 commits into from
May 4, 2019
Merged

Conversation

spastorino
Copy link
Member

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

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 2, 2019
Place::Projection(proj) => place = &proj.base,
Place::Base(PlaceBase::Static(_)) => return None,
Place::Base(PlaceBase::Local(local)) => return Some(*local),
}
Copy link
Contributor

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),
        }
    }
}

Copy link
Member Author

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.

@oli-obk
Copy link
Contributor

oli-obk commented May 3, 2019

@bors r+

@bors
Copy link
Contributor

bors commented May 3, 2019

📌 Commit 49f0141 has been approved by oli-obk

@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 May 3, 2019
Centril added a commit to Centril/rust that referenced this pull request May 3, 2019
… 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
Centril added a commit to Centril/rust that referenced this pull request May 3, 2019
… 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
Centril added a commit to Centril/rust that referenced this pull request May 4, 2019
… 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
bors added a commit that referenced this pull request May 4, 2019
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
@bors bors merged commit 49f0141 into rust-lang:master May 4, 2019
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants