Rollup merge of #69189 - matthewjasper:erase-the-world, r=nikomatsakis

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 #68261
r? @nikomatsakis
This commit is contained in:
Mazdak Farrokhzad 2020-03-18 18:03:35 +01:00 committed by GitHub
commit 3f583fc270
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
34 changed files with 264 additions and 237 deletions

View file

@ -21,7 +21,7 @@ LL | const ZST: &[u8] = unsafe { std::mem::transmute(1usize) };
| ^^^^^^^^^^^^^^^^^^^
|
= note: source type: `usize` (word size)
= note: target type: `&'static [u8]` (2 * word size)
= note: target type: `&[u8]` (2 * word size)
error: could not evaluate constant pattern
--> $DIR/transmute-size-mismatch-before-typeck.rs:10:9

View file

@ -14,7 +14,7 @@ LL | static BAR: _ = "test";
| ^
| |
| not allowed in type signatures
| help: replace `_` with the correct type: `&'static str`
| help: replace `_` with the correct type: `&str`
error: aborting due to 2 previous errors

View file

@ -4,8 +4,8 @@ error[E0512]: cannot transmute between types of different sizes, or dependently-
LL | let new: T::B = unsafe { std::mem::transmute(value) };
| ^^^^^^^^^^^^^^^^^^^
|
= note: source type: `<T as Trait<'a>>::A` (size can vary because of <T as Trait>::A)
= note: target type: `<T as Trait<'a>>::B` (size can vary because of <T as Trait>::B)
= note: source type: `<T as Trait>::A` (this type does not have a fixed size)
= note: target type: `<T as Trait>::B` (this type does not have a fixed size)
error: aborting due to previous error

View file

@ -1,4 +1,4 @@
error: the type `&'static T` does not permit zero-initialization
error: the type `&T` does not permit zero-initialization
--> $DIR/uninitialized-zeroed.rs:29:32
|
LL | let _val: &'static T = mem::zeroed();
@ -14,7 +14,7 @@ LL | #![deny(invalid_value)]
| ^^^^^^^^^^^^^
= note: references must be non-null
error: the type `&'static T` does not permit being left uninitialized
error: the type `&T` does not permit being left uninitialized
--> $DIR/uninitialized-zeroed.rs:30:32
|
LL | let _val: &'static T = mem::uninitialized();
@ -25,7 +25,7 @@ LL | let _val: &'static T = mem::uninitialized();
|
= note: references must be non-null
error: the type `Wrap<&'static T>` does not permit zero-initialization
error: the type `Wrap<&T>` does not permit zero-initialization
--> $DIR/uninitialized-zeroed.rs:32:38
|
LL | let _val: Wrap<&'static T> = mem::zeroed();
@ -40,7 +40,7 @@ note: references must be non-null (in this struct field)
LL | struct Wrap<T> { wrapped: T }
| ^^^^^^^^^^
error: the type `Wrap<&'static T>` does not permit being left uninitialized
error: the type `Wrap<&T>` does not permit being left uninitialized
--> $DIR/uninitialized-zeroed.rs:33:38
|
LL | let _val: Wrap<&'static T> = mem::uninitialized();
@ -121,7 +121,7 @@ LL | let _val: Void = mem::uninitialized();
|
= note: enums with no variants have no valid value
error: the type `&'static i32` does not permit zero-initialization
error: the type `&i32` does not permit zero-initialization
--> $DIR/uninitialized-zeroed.rs:49:34
|
LL | let _val: &'static i32 = mem::zeroed();
@ -132,7 +132,7 @@ LL | let _val: &'static i32 = mem::zeroed();
|
= note: references must be non-null
error: the type `&'static i32` does not permit being left uninitialized
error: the type `&i32` does not permit being left uninitialized
--> $DIR/uninitialized-zeroed.rs:50:34
|
LL | let _val: &'static i32 = mem::uninitialized();
@ -366,7 +366,7 @@ LL | let _val: NonBig = mem::uninitialized();
|
= note: `NonBig` must be initialized inside its custom valid range
error: the type `&'static i32` does not permit zero-initialization
error: the type `&i32` does not permit zero-initialization
--> $DIR/uninitialized-zeroed.rs:84:34
|
LL | let _val: &'static i32 = mem::transmute(0usize);
@ -377,7 +377,7 @@ LL | let _val: &'static i32 = mem::transmute(0usize);
|
= note: references must be non-null
error: the type `&'static [i32]` does not permit zero-initialization
error: the type `&[i32]` does not permit zero-initialization
--> $DIR/uninitialized-zeroed.rs:85:36
|
LL | let _val: &'static [i32] = mem::transmute((0usize, 0usize));

View file

@ -21,7 +21,7 @@ fn uninhab_union() -> Foo {
fn match_on_uninhab() {
match uninhab_ref() {
//~^ ERROR non-exhaustive patterns: type `&'static !` is non-empty
//~^ ERROR non-exhaustive patterns: type `&!` is non-empty
}
match uninhab_union() {

View file

@ -1,4 +1,4 @@
error[E0004]: non-exhaustive patterns: type `&'static !` is non-empty
error[E0004]: non-exhaustive patterns: type `&!` is non-empty
--> $DIR/always-inhabited-union-ref.rs:23:11
|
LL | match uninhab_ref() {

View file

@ -1,32 +1,54 @@
error[E0623]: lifetime mismatch
error[E0491]: in type `&'b &'a usize`, reference has a longer lifetime than the data it references
--> $DIR/regions-free-region-ordering-caller.rs:11:12
|
LL | fn call2<'a, 'b>(a: &'a usize, b: &'b usize) {
| --------- ---------
| |
| these two types are declared with different lifetimes...
LL | let z: Option<&'b &'a usize> = None;
| ^^^^^^^^^^^^^^^^^^^^^ ...but data from `a` flows into `b` here
| ^^^^^^^^^^^^^^^^^^^^^
|
note: the pointer is valid for the lifetime `'b` as defined on the function body at 10:14
--> $DIR/regions-free-region-ordering-caller.rs:10:14
|
LL | fn call2<'a, 'b>(a: &'a usize, b: &'b usize) {
| ^^
note: but the referenced data is only valid for the lifetime `'a` as defined on the function body at 10:10
--> $DIR/regions-free-region-ordering-caller.rs:10:10
|
LL | fn call2<'a, 'b>(a: &'a usize, b: &'b usize) {
| ^^
error[E0623]: lifetime mismatch
error[E0491]: in type `&'b Paramd<'a>`, reference has a longer lifetime than the data it references
--> $DIR/regions-free-region-ordering-caller.rs:17:12
|
LL | fn call3<'a, 'b>(a: &'a usize, b: &'b usize) {
| --------- ---------
| |
| these two types are declared with different lifetimes...
LL | let y: Paramd<'a> = Paramd { x: a };
LL | let z: Option<&'b Paramd<'a>> = None;
| ^^^^^^^^^^^^^^^^^^^^^^ ...but data from `a` flows into `b` here
| ^^^^^^^^^^^^^^^^^^^^^^
|
note: the pointer is valid for the lifetime `'b` as defined on the function body at 15:14
--> $DIR/regions-free-region-ordering-caller.rs:15:14
|
LL | fn call3<'a, 'b>(a: &'a usize, b: &'b usize) {
| ^^
note: but the referenced data is only valid for the lifetime `'a` as defined on the function body at 15:10
--> $DIR/regions-free-region-ordering-caller.rs:15:10
|
LL | fn call3<'a, 'b>(a: &'a usize, b: &'b usize) {
| ^^
error[E0623]: lifetime mismatch
error[E0491]: in type `&'a &'b usize`, reference has a longer lifetime than the data it references
--> $DIR/regions-free-region-ordering-caller.rs:22:12
|
LL | fn call4<'a, 'b>(a: &'a usize, b: &'b usize) {
| --------- --------- these two types are declared with different lifetimes...
LL | let z: Option<&'a &'b usize> = None;
| ^^^^^^^^^^^^^^^^^^^^^ ...but data from `b` flows into `a` here
| ^^^^^^^^^^^^^^^^^^^^^
|
note: the pointer is valid for the lifetime `'a` as defined on the function body at 21:10
--> $DIR/regions-free-region-ordering-caller.rs:21:10
|
LL | fn call4<'a, 'b>(a: &'a usize, b: &'b usize) {
| ^^
note: but the referenced data is only valid for the lifetime `'b` as defined on the function body at 21:14
--> $DIR/regions-free-region-ordering-caller.rs:21:14
|
LL | fn call4<'a, 'b>(a: &'a usize, b: &'b usize) {
| ^^
error: aborting due to 3 previous errors
For more information about this error, try `rustc --explain E0623`.
For more information about this error, try `rustc --explain E0491`.

View file

@ -8,18 +8,18 @@
struct Paramd<'a> { x: &'a usize }
fn call2<'a, 'b>(a: &'a usize, b: &'b usize) {
let z: Option<&'b &'a usize> = None;//[migrate]~ ERROR E0623
let z: Option<&'b &'a usize> = None;//[migrate]~ ERROR E0491
//[nll]~^ ERROR lifetime may not live long enough
}
fn call3<'a, 'b>(a: &'a usize, b: &'b usize) {
let y: Paramd<'a> = Paramd { x: a };
let z: Option<&'b Paramd<'a>> = None;//[migrate]~ ERROR E0623
let z: Option<&'b Paramd<'a>> = None;//[migrate]~ ERROR E0491
//[nll]~^ ERROR lifetime may not live long enough
}
fn call4<'a, 'b>(a: &'a usize, b: &'b usize) {
let z: Option<&'a &'b usize> = None;//[migrate]~ ERROR E0623
let z: Option<&'a &'b usize> = None;//[migrate]~ ERROR E0491
//[nll]~^ ERROR lifetime may not live long enough
}

View file

@ -43,4 +43,4 @@ static S = Vec::<String>::new();
static mut SM = "abc";
//~^ ERROR missing type for `static mut` item
//~| HELP provide a type for the item
//~| SUGGESTION &'static str
//~| SUGGESTION &str

View file

@ -14,7 +14,7 @@ error: missing type for `static mut` item
--> $DIR/const-no-type.rs:43:12
|
LL | static mut SM = "abc";
| ^^ help: provide a type for the item: `SM: &'static str`
| ^^ help: provide a type for the item: `SM: &str`
error: missing type for `const` item
--> $DIR/const-no-type.rs:14:7

View file

@ -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
error[E0512]: cannot transmute between types of different sizes, or dependently-sized types
--> $DIR/main.rs:20:17

View file

@ -70,7 +70,7 @@ LL | static TEST3: _ = "test";
| ^
| |
| not allowed in type signatures
| help: replace `_` with the correct type: `&'static str`
| help: replace `_` with the correct type: `&str`
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
--> $DIR/typeck_type_placeholder_item.rs:15:15
@ -232,7 +232,7 @@ LL | static FN_TEST3: _ = "test";
| ^
| |
| not allowed in type signatures
| help: replace `_` with the correct type: `&'static str`
| help: replace `_` with the correct type: `&str`
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
--> $DIR/typeck_type_placeholder_item.rs:88:22