Skip to content

Clear MIR local type annotations after borrowck #72520

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

Merged
merged 1 commit into from
May 25, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/librustc_mir/transform/cleanup_post_borrowck.rs
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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