Skip to content

Commit 997d953

Browse files
committed
Auto merge of rust-lang#72520 - jonas-schievink:cleanup-userty, r=matthewjasper
Clear MIR local type annotations after borrowck
2 parents 2679c38 + 2359299 commit 997d953

File tree

18 files changed

+21
-17
lines changed

18 files changed

+21
-17
lines changed

src/librustc_mir/transform/cleanup_post_borrowck.rs

+4
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ impl<'tcx> MirPass<'tcx> for CleanupNonCodegenStatements {
3535
let mut delete = DeleteNonCodegenStatements { tcx };
3636
delete.visit_body(body);
3737
body.user_type_annotations.raw.clear();
38+
39+
for decl in &mut body.local_decls {
40+
decl.user_ty = None;
41+
}
3842
}
3943
}
4044

src/test/incremental/hashes/let_expressions.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ pub fn add_type() {
3838

3939
#[cfg(not(cfail1))]
4040
#[rustc_clean(cfg="cfail2",
41-
except="hir_owner_nodes,typeck_tables_of,mir_built,optimized_mir")]
41+
except="hir_owner_nodes,typeck_tables_of,mir_built")]
4242
#[rustc_clean(cfg="cfail3")]
4343
pub fn add_type() {
4444
let _x: u32 = 2u32;

src/test/mir-opt/array-index-is-temporary/32bit/rustc.main.SimplifyCfg-elaborate-drops.after.mir

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ fn main() -> () {
1414
let mut _2: usize; // in scope 1 at $DIR/array-index-is-temporary.rs:14:9: 14:14
1515
scope 2 {
1616
debug y => _2; // in scope 2 at $DIR/array-index-is-temporary.rs:14:9: 14:14
17-
let _3: *mut usize as UserTypeProjection { base: UserType(0), projs: [] }; // in scope 2 at $DIR/array-index-is-temporary.rs:15:9: 15:10
17+
let _3: *mut usize; // in scope 2 at $DIR/array-index-is-temporary.rs:15:9: 15:10
1818
scope 3 {
1919
debug z => _3; // in scope 3 at $DIR/array-index-is-temporary.rs:15:9: 15:10
2020
scope 4 {

src/test/mir-opt/array-index-is-temporary/64bit/rustc.main.SimplifyCfg-elaborate-drops.after.mir

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ fn main() -> () {
1414
let mut _2: usize; // in scope 1 at $DIR/array-index-is-temporary.rs:14:9: 14:14
1515
scope 2 {
1616
debug y => _2; // in scope 2 at $DIR/array-index-is-temporary.rs:14:9: 14:14
17-
let _3: *mut usize as UserTypeProjection { base: UserType(0), projs: [] }; // in scope 2 at $DIR/array-index-is-temporary.rs:15:9: 15:10
17+
let _3: *mut usize; // in scope 2 at $DIR/array-index-is-temporary.rs:15:9: 15:10
1818
scope 3 {
1919
debug z => _3; // in scope 3 at $DIR/array-index-is-temporary.rs:15:9: 15:10
2020
scope 4 {

src/test/mir-opt/const_prop/array_index/32bit/rustc.main.ConstProp.diff

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

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

src/test/mir-opt/const_prop/array_index/64bit/rustc.main.ConstProp.diff

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

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

src/test/mir-opt/const_prop/bad_op_unsafe_oob_for_slices/32bit/rustc.main.ConstProp.diff

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
fn main() -> () {
55
let mut _0: (); // return place in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:4:11: 4:11
6-
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
6+
let _1: *const [i32]; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:5:9: 5:10
77
let mut _2: *const [i32; 3]; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:5:25: 5:35
88
let _3: &[i32; 3]; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:5:25: 5:35
99
let _4: [i32; 3]; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:5:26: 5:35

src/test/mir-opt/const_prop/bad_op_unsafe_oob_for_slices/64bit/rustc.main.ConstProp.diff

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
fn main() -> () {
55
let mut _0: (); // return place in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:4:11: 4:11
6-
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
6+
let _1: *const [i32]; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:5:9: 5:10
77
let mut _2: *const [i32; 3]; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:5:25: 5:35
88
let _3: &[i32; 3]; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:5:25: 5:35
99
let _4: [i32; 3]; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:5:26: 5:35

src/test/mir-opt/const_prop/checked_add/rustc.main.ConstProp.diff

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

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

src/test/mir-opt/const_prop/mutable_variable_aggregate_partial_read/rustc.main.ConstProp.diff

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
fn main() -> () {
55
let mut _0: (); // return place in scope 0 at $DIR/mutable_variable_aggregate_partial_read.rs:4:11: 4:11
6-
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
6+
let mut _1: (i32, i32); // in scope 0 at $DIR/mutable_variable_aggregate_partial_read.rs:5:9: 5:14
77
scope 1 {
88
debug x => _1; // in scope 1 at $DIR/mutable_variable_aggregate_partial_read.rs:5:9: 5:14
99
let _2: i32; // in scope 1 at $DIR/mutable_variable_aggregate_partial_read.rs:8:9: 8:10

src/test/mir-opt/const_prop/mutable_variable_unprop_assign/rustc.main.ConstProp.diff

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
let mut _3: i32; // in scope 0 at $DIR/mutable_variable_unprop_assign.rs:7:11: 7:12
88
scope 1 {
99
debug a => _1; // in scope 1 at $DIR/mutable_variable_unprop_assign.rs:5:9: 5:10
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
10+
let mut _2: (i32, i32); // in scope 1 at $DIR/mutable_variable_unprop_assign.rs:6:9: 6:14
1111
scope 2 {
1212
debug x => _2; // in scope 2 at $DIR/mutable_variable_unprop_assign.rs:6:9: 6:14
1313
let _4: i32; // in scope 2 at $DIR/mutable_variable_unprop_assign.rs:8:9: 8:10

src/test/mir-opt/const_prop/repeat/32bit/rustc.main.ConstProp.diff

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

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

src/test/mir-opt/const_prop/repeat/64bit/rustc.main.ConstProp.diff

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

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

src/test/mir-opt/inline/inline-into-box-place/32bit/rustc.main.Inline.diff

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
fn main() -> () {
55
let mut _0: (); // return place in scope 0 at $DIR/inline-into-box-place.rs:7:11: 7:11
6-
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
6+
let _1: std::boxed::Box<std::vec::Vec<u32>>; // in scope 0 at $DIR/inline-into-box-place.rs:8:9: 8:11
77
let mut _2: std::boxed::Box<std::vec::Vec<u32>>; // in scope 0 at $DIR/inline-into-box-place.rs:8:29: 8:43
88
let mut _3: (); // in scope 0 at $DIR/inline-into-box-place.rs:8:42: 8:43
99
+ let mut _4: &mut std::vec::Vec<u32>; // in scope 0 at $DIR/inline-into-box-place.rs:8:33: 8:43

src/test/mir-opt/inline/inline-into-box-place/64bit/rustc.main.Inline.diff

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
fn main() -> () {
55
let mut _0: (); // return place in scope 0 at $DIR/inline-into-box-place.rs:7:11: 7:11
6-
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
6+
let _1: std::boxed::Box<std::vec::Vec<u32>>; // in scope 0 at $DIR/inline-into-box-place.rs:8:9: 8:11
77
let mut _2: std::boxed::Box<std::vec::Vec<u32>>; // in scope 0 at $DIR/inline-into-box-place.rs:8:29: 8:43
88
let mut _3: (); // in scope 0 at $DIR/inline-into-box-place.rs:8:42: 8:43
99
+ let mut _4: &mut std::vec::Vec<u32>; // in scope 0 at $DIR/inline-into-box-place.rs:8:33: 8:43

src/test/mir-opt/retag/rustc.main.SimplifyCfg-elaborate-drops.after.mir

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ fn main() -> () {
2424
scope 1 {
2525
debug x => _1; // in scope 1 at $DIR/retag.rs:30:9: 30:14
2626
let _3: &mut i32; // in scope 1 at $DIR/retag.rs:32:13: 32:14
27-
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
27+
let _13: for<'r> fn(&'r i32) -> &'r i32; // in scope 1 at $DIR/retag.rs:40:9: 40:10
2828
scope 2 {
2929
debug v => _3; // in scope 2 at $DIR/retag.rs:32:13: 32:14
3030
let _8: &mut i32; // in scope 2 at $DIR/retag.rs:33:13: 33:14

src/test/mir-opt/simplify-arm-identity/32bit/rustc.main.SimplifyArmIdentity.diff

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

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

src/test/mir-opt/simplify-arm-identity/64bit/rustc.main.SimplifyArmIdentity.diff

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

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

0 commit comments

Comments
 (0)