Skip to content

Commit 997d953

Browse files
committed
Auto merge of #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

Lines changed: 4 additions & 0 deletions
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

0 commit comments

Comments
 (0)