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

Some Promotion Refactoring #80458

Merged
merged 4 commits into from
Dec 31, 2020
Merged

Some Promotion Refactoring #80458

merged 4 commits into from
Dec 31, 2020

Conversation

RalfJung
Copy link
Member

Clean up promotion a bit:

  • factor out some common code
  • more exhaustive matches

This should not break anything... the only potentially-breaking change is that BorrowKind::Shallow | BorrowKind::Unique are now rejected for internal references.

r? @oli-obk

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Dec 28, 2020
compiler/rustc_mir/src/transform/promote_consts.rs Outdated Show resolved Hide resolved
}

Rvalue::Ref(_, kind, place) => {
// Special-case reborrows to be more like a copy of the reference.
let mut place_simplified = place.as_ref();
if let [proj_base @ .., ProjectionElem::Deref] = &place_simplified.projection {
let base_ty = Place::ty_from(place_simplified.local, proj_base, self.body, self.tcx).ty;
let base_ty =
Place::ty_from(place_simplified.local, proj_base, self.body, self.tcx).ty;
Copy link
Contributor

Choose a reason for hiding this comment

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

huh what happened here?

Copy link
Member Author

Choose a reason for hiding this comment

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

Just rustfmt, or is there any other difference that I am missing?

Copy link
Contributor

Choose a reason for hiding this comment

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

yea, but I was confused why rustfmt would do this.

Copy link
Member Author

Choose a reason for hiding this comment

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

Because it is being rustfmt? ;)

The variable name got longer, since I need to keep the original place around. As a result this line crossed the threshold.

Copy link
Contributor

Choose a reason for hiding this comment

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

oh... this is due to an intermediate state that was reverted later? Because this specific line is exactly the same (modulo whitespace) as the line that was there before.

Copy link
Member Author

Choose a reason for hiding this comment

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

Maybe I didn't fmt between all commits.

@oli-obk
Copy link
Contributor

oli-obk commented Dec 29, 2020

@bors r+

@bors
Copy link
Contributor

bors commented Dec 29, 2020

📌 Commit 51cec58 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 Dec 29, 2020
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request Dec 30, 2020
Some Promotion Refactoring

Clean up promotion a bit:
* factor out some common code
* more exhaustive matches

This *should* not break anything... the only potentially-breaking change is that `BorrowKind::Shallow | BorrowKind::Unique` are now rejected for internal references.

r? `@oli-obk`
bors added a commit to rust-lang-ci/rust that referenced this pull request Dec 30, 2020
Rollup of 9 pull requests

Successful merges:

 - rust-lang#78934 (refactor: removing library/alloc/src/vec/mod.rs ignore-tidy-filelength)
 - rust-lang#79479 (Add `Iterator::intersperse`)
 - rust-lang#80128 (Edit rustc_ast::ast::FieldPat docs)
 - rust-lang#80424 (Don't give an error when creating a file for the first time)
 - rust-lang#80458 (Some Promotion Refactoring)
 - rust-lang#80488 (Do not create dangling &T in Weak<T>::drop)
 - rust-lang#80491 (Miri: make size/align_of_val work for dangling raw ptrs)
 - rust-lang#80495 (Rename kw::Invalid -> kw::Empty)
 - rust-lang#80513 (Add regression test for rust-lang#80062)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 46111c1 into rust-lang:master Dec 31, 2020
@rustbot rustbot added this to the 1.51.0 milestone Dec 31, 2020
@RalfJung RalfJung deleted the promotion-refactor branch December 31, 2020 13:03
rylev added a commit to rylev/rust that referenced this pull request Jan 5, 2021
…, r=oli-obk"

This reverts commit 46111c1, reversing
changes made to 1975142.
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