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

Erase regions in writeback #69189

Merged
merged 4 commits into from
Mar 19, 2020
Merged

Conversation

matthewjasper
Copy link
Contributor

Regions in TypeckTables (except canonicalized user annotations) are now erased. Further, we no longer do lexical region solving on item bodies with -Zborrowck=mir.

cc #68261
r? @nikomatsakis

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Feb 15, 2020
bors added a commit to rust-lang/rust-clippy that referenced this pull request Feb 15, 2020
Avoid using regions from `TypeckTables`

These regions will all be `ReErased` soon. (rust-lang/rust#69189)

changelog: none
@rust-highfive

This comment has been minimized.

@bors
Copy link
Contributor

bors commented Feb 17, 2020

☔ The latest upstream changes (presumably #67953) made this pull request unmergeable. Please resolve the merge conflicts.

@JohnCSimon JohnCSimon added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 2, 2020
@joelpalmer
Copy link

Triaged

@matthewjasper matthewjasper added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Mar 12, 2020
#[derive(Copy, Clone, Default, Debug)]
pub struct SuppressRegionErrors {
suppressed: bool,
#[derive(Copy, Clone, Debug)]
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we add a doc comment explaining the overall role of this type?

Copy link
Contributor

Choose a reason for hiding this comment

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

I was imagining that we might give some coverage of how regions are handled in type-check vs NLL here. Though really we ought to explain this in a rustc-dev-guide section and link to that

@nikomatsakis
Copy link
Contributor

r=me with a comment, cc @matthewjasper

@nikomatsakis nikomatsakis added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 12, 2020
@matthewjasper
Copy link
Contributor Author

@bors r=nikomatsakis

@bors
Copy link
Contributor

bors commented Mar 12, 2020

📌 Commit f8a08a9 has been approved by nikomatsakis

@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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Mar 12, 2020
Centril added a commit to Centril/rust that referenced this pull request Mar 12, 2020
…komatsakis

Erase regions in writeback

Regions in `TypeckTables` (except canonicalized user annotations) are now erased. Further, we no longer do lexical region solving on item bodies with `-Zborrowck=mir`.

cc rust-lang#68261
r? @nikomatsakis
bors added a commit that referenced this pull request Mar 13, 2020
Rollup of 8 pull requests

Successful merges:

 - #68746 (Make macro metavars respect (non-)hygiene)
 - #69189 (Erase regions in writeback)
 - #69402 (Extend search)
 - #69403 (Implement `Copy` for `IoSlice`)
 - #69460 (Move some `build-pass` tests to `check-pass`)
 - #69802 (fix more clippy findings)
 - #69809 (remove lifetimes that can be elided (clippy::needless_lifetimes))
 - #69949 (triagebot.toml: add ping aliases)

Failed merges:

 - #69589 (ast: `Mac`/`Macro` -> `MacCall`)

r? @ghost
@bors
Copy link
Contributor

bors commented Mar 14, 2020

☔ The latest upstream changes (presumably #69076) made this pull request unmergeable. Please resolve the merge conflicts.

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Mar 14, 2020
Centril added a commit to Centril/rust that referenced this pull request Mar 18, 2020
…komatsakis

Erase regions in writeback

Regions in `TypeckTables` (except canonicalized user annotations) are now erased. Further, we no longer do lexical region solving on item bodies with `-Zborrowck=mir`.

cc rust-lang#68261
r? @nikomatsakis
Centril added a commit to Centril/rust that referenced this pull request Mar 18, 2020
…komatsakis

Erase regions in writeback

Regions in `TypeckTables` (except canonicalized user annotations) are now erased. Further, we no longer do lexical region solving on item bodies with `-Zborrowck=mir`.

cc rust-lang#68261
r? @nikomatsakis
pietroalbini added a commit to pietroalbini/rust that referenced this pull request Mar 18, 2020
Rollup of 10 pull requests

Successful merges:

 - rust-lang#67749 (keyword docs for else and inkeyword docs for else and in.)
 - rust-lang#69139 (clean up E0308 explanation)
 - rust-lang#69189 (Erase regions in writeback)
 - rust-lang#69837 (Use smaller discriminants for generators)
 - rust-lang#69838 (Expansion-driven outline module parsing)
 - rust-lang#69839 (Miri error reform)
 - rust-lang#69899 (Make methods declared by `newtype_index` macro `const`)
 - rust-lang#69920 (Remove some imports to the rustc crate)
 - rust-lang#70075 (Fix repr pretty display)
 - rust-lang#70106 (Tidy: fix running rustfmt twice)

Failed merges:

 - rust-lang#70051 (Allow `hir().find` to return `None`)
 - rust-lang#70074 (Expand: nix all fatal errors)

r? @ghost
@bors bors merged commit 3f583fc into rust-lang:master Mar 19, 2020
@@ -4,8 +4,7 @@ error[E0512]: cannot transmute between types of different sizes, or dependently-
LL | transmute(x)
| ^^^^^^^^^
|
= note: source type: `<C as TypeConstructor<'a>>::T` (size can vary because of <C as TypeConstructor>::T)
= note: target type: `<C as TypeConstructor<'b>>::T` (size can vary because of <C as TypeConstructor>::T)
= note: `<C as TypeConstructor>::T` does not have a fixed size
Copy link
Member

Choose a reason for hiding this comment

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

Wait, we don't allow transmuting between the same type with only lifetimes changed?
I think we do when it's beyond a pointer, even if we don't know if it's Sized.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We don't allow transmutes between type projections at all it seems:

pub trait TypeConstructor {
    type T;
}

unsafe fn transmute_lifetime<C>(x: C::T)
where C: TypeConstructor {
    transmute::<C::T, C::T>(x); // ERROR !
}

@matthewjasper matthewjasper deleted the erase-the-world branch March 19, 2020 09:00
@flip1995
Copy link
Member

@matthewjasper Question regarding a Clippy rustup: rust-lang/rust-clippy#5333

Clippy has a check in the linting code that compares two types like this:

cx.tcx.expr_ty(expr1) == cx.tcx.expr_ty(expr2)

Before this PR, this returned false for &'a T == &'b T. Now it doesn't take the different lifetimes into account and returns true. Do you know of a way to compare two types taking their (user-defined) lifetimes into account?

flip1995 added a commit to flip1995/rust-clippy that referenced this pull request Mar 19, 2020
rustup rust-lang/rust#69189

rustups rust-lang/rust#69189 which is part of rust-lang/rust#70085
(at least I think this is the only pr that changes clippy test stdout)

changelog: none
@eddyb
Copy link
Member

eddyb commented Mar 19, 2020

@flip1995 No, you were getting lucky before if that worked.
The only thing that can accurately reason about lifetimes is MIR borrowck.

bors added a commit to rust-lang/rust-clippy that referenced this pull request Mar 19, 2020
Rollup of 4 pull requests

Successful merges:

 - #5326 (rustup rust-lang/rust#69838)
 - #5333 (rustup rust-lang/rust#69189)
 - #5336 (rustup rust-lang/rust#69920)
 - #5341 (Rustup to rust-lang/rust#66131)

Failed merges:

r? @ghost
bors added a commit to rust-lang/rust-clippy that referenced this pull request Mar 19, 2020
Rollup of 4 pull requests

Successful merges:

 - #5326 (rustup rust-lang/rust#69838)
 - #5333 (rustup rust-lang/rust#69189)
 - #5336 (rustup rust-lang/rust#69920)
 - #5341 (Rustup to rust-lang/rust#66131)

Failed merges:

r? @ghost

changelog: none
bors added a commit to rust-lang/rust-clippy that referenced this pull request Mar 19, 2020
Rollup of 4 pull requests

Successful merges:

 - #5326 (rustup rust-lang/rust#69838)
 - #5333 (rustup rust-lang/rust#69189)
 - #5336 (rustup rust-lang/rust#69920)
 - #5341 (Rustup to rust-lang/rust#66131)

Failed merges:

r? @ghost

changelog: none
bors added a commit to rust-lang/rust-clippy that referenced this pull request Mar 19, 2020
Rollup of 4 pull requests

Successful merges:

 - #5326 (rustup rust-lang/rust#69838)
 - #5333 (rustup rust-lang/rust#69189)
 - #5336 (rustup rust-lang/rust#69920)
 - #5341 (Rustup to rust-lang/rust#66131)

Failed merges:

r? @ghost

changelog: none
bors added a commit to rust-lang/rust-clippy that referenced this pull request Mar 19, 2020
Rollup of 4 pull requests

Successful merges:

 - #5326 (rustup rust-lang/rust#69838)
 - #5333 (rustup rust-lang/rust#69189)
 - #5336 (rustup rust-lang/rust#69920)
 - #5341 (Rustup to rust-lang/rust#66131)

Failed merges:

r? @ghost

changelog: none
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.

9 participants