Skip to content

Commit

Permalink
Clear MIR local type annotations after borrowck
Browse files Browse the repository at this point in the history
  • Loading branch information
jonas-schievink committed May 24, 2020
1 parent 4774f9b commit 2359299
Show file tree
Hide file tree
Showing 18 changed files with 21 additions and 17 deletions.
4 changes: 4 additions & 0 deletions src/librustc_mir/transform/cleanup_post_borrowck.rs
Expand Up @@ -35,6 +35,10 @@ impl<'tcx> MirPass<'tcx> for CleanupNonCodegenStatements {
let mut delete = DeleteNonCodegenStatements { tcx };
delete.visit_body(body);
body.user_type_annotations.raw.clear();

for decl in &mut body.local_decls {
decl.user_ty = None;
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/test/incremental/hashes/let_expressions.rs
Expand Up @@ -38,7 +38,7 @@ pub fn add_type() {

#[cfg(not(cfail1))]
#[rustc_clean(cfg="cfail2",
except="hir_owner_nodes,typeck_tables_of,mir_built,optimized_mir")]
except="hir_owner_nodes,typeck_tables_of,mir_built")]
#[rustc_clean(cfg="cfail3")]
pub fn add_type() {
let _x: u32 = 2u32;
Expand Down
Expand Up @@ -14,7 +14,7 @@ fn main() -> () {
let mut _2: usize; // in scope 1 at $DIR/array-index-is-temporary.rs:14:9: 14:14
scope 2 {
debug y => _2; // in scope 2 at $DIR/array-index-is-temporary.rs:14:9: 14:14
let _3: *mut usize as UserTypeProjection { base: UserType(0), projs: [] }; // in scope 2 at $DIR/array-index-is-temporary.rs:15:9: 15:10
let _3: *mut usize; // in scope 2 at $DIR/array-index-is-temporary.rs:15:9: 15:10
scope 3 {
debug z => _3; // in scope 3 at $DIR/array-index-is-temporary.rs:15:9: 15:10
scope 4 {
Expand Down
Expand Up @@ -14,7 +14,7 @@ fn main() -> () {
let mut _2: usize; // in scope 1 at $DIR/array-index-is-temporary.rs:14:9: 14:14
scope 2 {
debug y => _2; // in scope 2 at $DIR/array-index-is-temporary.rs:14:9: 14:14
let _3: *mut usize as UserTypeProjection { base: UserType(0), projs: [] }; // in scope 2 at $DIR/array-index-is-temporary.rs:15:9: 15:10
let _3: *mut usize; // in scope 2 at $DIR/array-index-is-temporary.rs:15:9: 15:10
scope 3 {
debug z => _3; // in scope 3 at $DIR/array-index-is-temporary.rs:15:9: 15:10
scope 4 {
Expand Down
Expand Up @@ -3,7 +3,7 @@

fn main() -> () {
let mut _0: (); // return place in scope 0 at $DIR/array_index.rs:4:11: 4:11
let _1: u32 as UserTypeProjection { base: UserType(0), projs: [] }; // in scope 0 at $DIR/array_index.rs:5:9: 5:10
let _1: u32; // in scope 0 at $DIR/array_index.rs:5:9: 5:10
let mut _2: [u32; 4]; // in scope 0 at $DIR/array_index.rs:5:18: 5:30
let _3: usize; // in scope 0 at $DIR/array_index.rs:5:31: 5:32
let mut _4: usize; // in scope 0 at $DIR/array_index.rs:5:18: 5:33
Expand Down
Expand Up @@ -3,7 +3,7 @@

fn main() -> () {
let mut _0: (); // return place in scope 0 at $DIR/array_index.rs:4:11: 4:11
let _1: u32 as UserTypeProjection { base: UserType(0), projs: [] }; // in scope 0 at $DIR/array_index.rs:5:9: 5:10
let _1: u32; // in scope 0 at $DIR/array_index.rs:5:9: 5:10
let mut _2: [u32; 4]; // in scope 0 at $DIR/array_index.rs:5:18: 5:30
let _3: usize; // in scope 0 at $DIR/array_index.rs:5:31: 5:32
let mut _4: usize; // in scope 0 at $DIR/array_index.rs:5:18: 5:33
Expand Down
Expand Up @@ -3,7 +3,7 @@

fn main() -> () {
let mut _0: (); // return place in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:4:11: 4:11
let _1: *const [i32] as UserTypeProjection { base: UserType(0), projs: [] }; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:5:9: 5:10
let _1: *const [i32]; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:5:9: 5:10
let mut _2: *const [i32; 3]; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:5:25: 5:35
let _3: &[i32; 3]; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:5:25: 5:35
let _4: [i32; 3]; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:5:26: 5:35
Expand Down
Expand Up @@ -3,7 +3,7 @@

fn main() -> () {
let mut _0: (); // return place in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:4:11: 4:11
let _1: *const [i32] as UserTypeProjection { base: UserType(0), projs: [] }; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:5:9: 5:10
let _1: *const [i32]; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:5:9: 5:10
let mut _2: *const [i32; 3]; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:5:25: 5:35
let _3: &[i32; 3]; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:5:25: 5:35
let _4: [i32; 3]; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:5:26: 5:35
Expand Down
Expand Up @@ -3,7 +3,7 @@

fn main() -> () {
let mut _0: (); // return place in scope 0 at $DIR/checked_add.rs:4:11: 4:11
let _1: u32 as UserTypeProjection { base: UserType(0), projs: [] }; // in scope 0 at $DIR/checked_add.rs:5:9: 5:10
let _1: u32; // in scope 0 at $DIR/checked_add.rs:5:9: 5:10
let mut _2: (u32, bool); // in scope 0 at $DIR/checked_add.rs:5:18: 5:23
scope 1 {
debug x => _1; // in scope 1 at $DIR/checked_add.rs:5:9: 5:10
Expand Down
Expand Up @@ -3,7 +3,7 @@

fn main() -> () {
let mut _0: (); // return place in scope 0 at $DIR/mutable_variable_aggregate_partial_read.rs:4:11: 4:11
let mut _1: (i32, i32) as UserTypeProjection { base: UserType(0), projs: [] }; // in scope 0 at $DIR/mutable_variable_aggregate_partial_read.rs:5:9: 5:14
let mut _1: (i32, i32); // in scope 0 at $DIR/mutable_variable_aggregate_partial_read.rs:5:9: 5:14
scope 1 {
debug x => _1; // in scope 1 at $DIR/mutable_variable_aggregate_partial_read.rs:5:9: 5:14
let _2: i32; // in scope 1 at $DIR/mutable_variable_aggregate_partial_read.rs:8:9: 8:10
Expand Down
Expand Up @@ -7,7 +7,7 @@
let mut _3: i32; // in scope 0 at $DIR/mutable_variable_unprop_assign.rs:7:11: 7:12
scope 1 {
debug a => _1; // in scope 1 at $DIR/mutable_variable_unprop_assign.rs:5:9: 5:10
let mut _2: (i32, i32) as UserTypeProjection { base: UserType(0), projs: [] }; // in scope 1 at $DIR/mutable_variable_unprop_assign.rs:6:9: 6:14
let mut _2: (i32, i32); // in scope 1 at $DIR/mutable_variable_unprop_assign.rs:6:9: 6:14
scope 2 {
debug x => _2; // in scope 2 at $DIR/mutable_variable_unprop_assign.rs:6:9: 6:14
let _4: i32; // in scope 2 at $DIR/mutable_variable_unprop_assign.rs:8:9: 8:10
Expand Down
Expand Up @@ -3,7 +3,7 @@

fn main() -> () {
let mut _0: (); // return place in scope 0 at $DIR/repeat.rs:5:11: 5:11
let _1: u32 as UserTypeProjection { base: UserType(0), projs: [] }; // in scope 0 at $DIR/repeat.rs:6:9: 6:10
let _1: u32; // in scope 0 at $DIR/repeat.rs:6:9: 6:10
let mut _2: u32; // in scope 0 at $DIR/repeat.rs:6:18: 6:28
let mut _3: [u32; 8]; // in scope 0 at $DIR/repeat.rs:6:18: 6:25
let _4: usize; // in scope 0 at $DIR/repeat.rs:6:26: 6:27
Expand Down
Expand Up @@ -3,7 +3,7 @@

fn main() -> () {
let mut _0: (); // return place in scope 0 at $DIR/repeat.rs:5:11: 5:11
let _1: u32 as UserTypeProjection { base: UserType(0), projs: [] }; // in scope 0 at $DIR/repeat.rs:6:9: 6:10
let _1: u32; // in scope 0 at $DIR/repeat.rs:6:9: 6:10
let mut _2: u32; // in scope 0 at $DIR/repeat.rs:6:18: 6:28
let mut _3: [u32; 8]; // in scope 0 at $DIR/repeat.rs:6:18: 6:25
let _4: usize; // in scope 0 at $DIR/repeat.rs:6:26: 6:27
Expand Down
Expand Up @@ -3,7 +3,7 @@

fn main() -> () {
let mut _0: (); // return place in scope 0 at $DIR/inline-into-box-place.rs:7:11: 7:11
let _1: std::boxed::Box<std::vec::Vec<u32>> as UserTypeProjection { base: UserType(0), projs: [] }; // in scope 0 at $DIR/inline-into-box-place.rs:8:9: 8:11
let _1: std::boxed::Box<std::vec::Vec<u32>>; // in scope 0 at $DIR/inline-into-box-place.rs:8:9: 8:11
let mut _2: std::boxed::Box<std::vec::Vec<u32>>; // in scope 0 at $DIR/inline-into-box-place.rs:8:29: 8:43
let mut _3: (); // in scope 0 at $DIR/inline-into-box-place.rs:8:42: 8:43
+ let mut _4: &mut std::vec::Vec<u32>; // in scope 0 at $DIR/inline-into-box-place.rs:8:33: 8:43
Expand Down
Expand Up @@ -3,7 +3,7 @@

fn main() -> () {
let mut _0: (); // return place in scope 0 at $DIR/inline-into-box-place.rs:7:11: 7:11
let _1: std::boxed::Box<std::vec::Vec<u32>> as UserTypeProjection { base: UserType(0), projs: [] }; // in scope 0 at $DIR/inline-into-box-place.rs:8:9: 8:11
let _1: std::boxed::Box<std::vec::Vec<u32>>; // in scope 0 at $DIR/inline-into-box-place.rs:8:9: 8:11
let mut _2: std::boxed::Box<std::vec::Vec<u32>>; // in scope 0 at $DIR/inline-into-box-place.rs:8:29: 8:43
let mut _3: (); // in scope 0 at $DIR/inline-into-box-place.rs:8:42: 8:43
+ let mut _4: &mut std::vec::Vec<u32>; // in scope 0 at $DIR/inline-into-box-place.rs:8:33: 8:43
Expand Down
Expand Up @@ -24,7 +24,7 @@ fn main() -> () {
scope 1 {
debug x => _1; // in scope 1 at $DIR/retag.rs:30:9: 30:14
let _3: &mut i32; // in scope 1 at $DIR/retag.rs:32:13: 32:14
let _13: for<'r> fn(&'r i32) -> &'r i32 as UserTypeProjection { base: UserType(1), projs: [] }; // in scope 1 at $DIR/retag.rs:40:9: 40:10
let _13: for<'r> fn(&'r i32) -> &'r i32; // in scope 1 at $DIR/retag.rs:40:9: 40:10
scope 2 {
debug v => _3; // in scope 2 at $DIR/retag.rs:32:13: 32:14
let _8: &mut i32; // in scope 2 at $DIR/retag.rs:33:13: 33:14
Expand Down
Expand Up @@ -3,7 +3,7 @@

fn main() -> () {
let mut _0: (); // return place in scope 0 at $DIR/simplify-arm-identity.rs:17:11: 17:11
let _1: Src as UserTypeProjection { base: UserType(0), projs: [] }; // in scope 0 at $DIR/simplify-arm-identity.rs:18:9: 18:10
let _1: Src; // in scope 0 at $DIR/simplify-arm-identity.rs:18:9: 18:10
let mut _2: Dst; // in scope 0 at $DIR/simplify-arm-identity.rs:19:18: 22:6
let mut _3: isize; // in scope 0 at $DIR/simplify-arm-identity.rs:20:9: 20:20
let mut _5: u8; // in scope 0 at $DIR/simplify-arm-identity.rs:20:33: 20:34
Expand Down
Expand Up @@ -3,7 +3,7 @@

fn main() -> () {
let mut _0: (); // return place in scope 0 at $DIR/simplify-arm-identity.rs:17:11: 17:11
let _1: Src as UserTypeProjection { base: UserType(0), projs: [] }; // in scope 0 at $DIR/simplify-arm-identity.rs:18:9: 18:10
let _1: Src; // in scope 0 at $DIR/simplify-arm-identity.rs:18:9: 18:10
let mut _2: Dst; // in scope 0 at $DIR/simplify-arm-identity.rs:19:18: 22:6
let mut _3: isize; // in scope 0 at $DIR/simplify-arm-identity.rs:20:9: 20:20
let mut _5: u8; // in scope 0 at $DIR/simplify-arm-identity.rs:20:33: 20:34
Expand Down

0 comments on commit 2359299

Please sign in to comment.