Skip to content

Commit 2bfb462

Browse files
committed
rustc_mir: don't throw away inlined locals' spans.
1 parent 387e31c commit 2bfb462

19 files changed

+57
-58
lines changed

compiler/rustc_mir/src/transform/inline.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,6 @@ impl Inliner<'tcx> {
469469
let mut local = callee_body.local_decls[loc].clone();
470470

471471
local.source_info.scope = scope_map[local.source_info.scope];
472-
local.source_info.span = callsite.source_info.span;
473472

474473
let idx = caller_body.local_decls.push(local);
475474
local_map.push(idx);

src/test/mir-opt/generator_drop_cleanup.main-{closure#0}.generator_drop.0.mir

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ fn main::{closure#0}(_1: *mut [generator@$DIR/generator-drop-cleanup.rs:10:15: 1
2727
debug _s => (((*_1) as variant#3).0: std::string::String); // in scope 1 at $DIR/generator-drop-cleanup.rs:11:13: 11:15
2828
}
2929
scope 2 (inlined String::new) { // at $DIR/generator-drop-cleanup.rs:11:18: 11:31
30-
let mut _6: std::vec::Vec<u8>; // in scope 2 at $DIR/generator-drop-cleanup.rs:11:18: 11:31
30+
let mut _6: std::vec::Vec<u8>; // in scope 2 at $SRC_DIR/alloc/src/string.rs:LL:COL
3131
scope 3 (inlined Vec::<u8>::new) { // at $SRC_DIR/alloc/src/string.rs:LL:COL
3232
}
3333
}

src/test/mir-opt/inline/inline_any_operand.bar.Inline.after.mir

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ fn bar() -> bool {
1111
scope 2 (inlined foo) { // at $DIR/inline-any-operand.rs:12:5: 12:13
1212
debug x => _5; // in scope 2 at $DIR/inline-any-operand.rs:16:8: 16:9
1313
debug y => _6; // in scope 2 at $DIR/inline-any-operand.rs:16:16: 16:17
14-
let mut _3: i32; // in scope 2 at $DIR/inline-any-operand.rs:12:5: 12:13
15-
let mut _4: i32; // in scope 2 at $DIR/inline-any-operand.rs:12:5: 12:13
14+
let mut _3: i32; // in scope 2 at $DIR/inline-any-operand.rs:17:5: 17:6
15+
let mut _4: i32; // in scope 2 at $DIR/inline-any-operand.rs:17:10: 17:11
1616
}
1717
}
1818

src/test/mir-opt/inline/inline_closure_borrows_arg.foo.Inline.after.mir

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ fn foo(_1: T, _2: &i32) -> i32 {
1616
scope 2 (inlined foo::<T>::{closure#0}) { // at $DIR/inline-closure-borrows-arg.rs:16:5: 16:12
1717
debug r => _9; // in scope 2 at $DIR/inline-closure-borrows-arg.rs:12:14: 12:15
1818
debug _s => _10; // in scope 2 at $DIR/inline-closure-borrows-arg.rs:12:23: 12:25
19-
let _8: &i32; // in scope 2 at $DIR/inline-closure-borrows-arg.rs:16:5: 16:12
19+
let _8: &i32; // in scope 2 at $DIR/inline-closure-borrows-arg.rs:13:13: 13:21
2020
scope 3 {
2121
debug variable => _8; // in scope 3 at $DIR/inline-closure-borrows-arg.rs:13:13: 13:21
2222
}

src/test/mir-opt/inline/inline_closure_captures.foo.Inline.after.mir

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ fn foo(_1: T, _2: i32) -> (i32, T) {
1717
debug _q => _10; // in scope 2 at $DIR/inline-closure-captures.rs:11:14: 11:16
1818
debug q => (*((*_6).0: &i32)); // in scope 2 at $DIR/inline-closure-captures.rs:10:23: 10:24
1919
debug t => (*((*_6).1: &T)); // in scope 2 at $DIR/inline-closure-captures.rs:10:17: 10:18
20-
let mut _9: T; // in scope 2 at $DIR/inline-closure-captures.rs:12:5: 12:9
20+
let mut _9: T; // in scope 2 at $DIR/inline-closure-captures.rs:11:22: 11:23
2121
}
2222
}
2323

src/test/mir-opt/inline/inline_retag.bar.Inline.after.mir

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ fn bar() -> bool {
1717
scope 2 (inlined foo) { // at $DIR/inline-retag.rs:12:5: 12:15
1818
debug x => _3; // in scope 2 at $DIR/inline-retag.rs:16:8: 16:9
1919
debug y => _6; // in scope 2 at $DIR/inline-retag.rs:16:17: 16:18
20-
let mut _11: i32; // in scope 2 at $DIR/inline-retag.rs:12:5: 12:15
21-
let mut _12: i32; // in scope 2 at $DIR/inline-retag.rs:12:5: 12:15
20+
let mut _11: i32; // in scope 2 at $DIR/inline-retag.rs:17:5: 17:7
21+
let mut _12: i32; // in scope 2 at $DIR/inline-retag.rs:17:11: 17:13
2222
}
2323
}
2424

src/test/mir-opt/inline/inline_trait_method_2.test2.Inline.after.mir

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ fn test2(_1: &dyn X) -> bool {
77
let mut _3: &dyn X; // in scope 0 at $DIR/inline-trait-method_2.rs:5:10: 5:11
88
scope 1 (inlined test) { // at $DIR/inline-trait-method_2.rs:5:5: 5:12
99
debug x => _2; // in scope 1 at $DIR/inline-trait-method_2.rs:9:9: 9:10
10-
let mut _4: &dyn X; // in scope 1 at $DIR/inline-trait-method_2.rs:5:5: 5:12
10+
let mut _4: &dyn X; // in scope 1 at $DIR/inline-trait-method_2.rs:10:5: 10:6
1111
}
1212

1313
bb0: {

src/test/mir-opt/inline/issue_58867_inline_as_ref_as_mut.a.Inline.after.mir

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ fn a(_1: &mut [T]) -> &mut [T] {
88
let mut _4: &mut [T]; // in scope 0 at $DIR/issue-58867-inline-as-ref-as-mut.rs:3:5: 3:6
99
scope 1 (inlined <[T] as AsMut<[T]>>::as_mut) { // at $DIR/issue-58867-inline-as-ref-as-mut.rs:3:5: 3:15
1010
debug self => _4; // in scope 1 at $SRC_DIR/core/src/convert/mod.rs:LL:COL
11-
let mut _5: &mut [T]; // in scope 1 at $DIR/issue-58867-inline-as-ref-as-mut.rs:3:5: 3:15
11+
let mut _5: &mut [T]; // in scope 1 at $SRC_DIR/core/src/convert/mod.rs:LL:COL
1212
}
1313

1414
bb0: {

src/test/mir-opt/inline/issue_58867_inline_as_ref_as_mut.b.Inline.after.mir

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ fn b(_1: &mut Box<T>) -> &mut T {
88
let mut _4: &mut std::boxed::Box<T>; // in scope 0 at $DIR/issue-58867-inline-as-ref-as-mut.rs:8:5: 8:6
99
scope 1 (inlined <Box<T> as AsMut<T>>::as_mut) { // at $DIR/issue-58867-inline-as-ref-as-mut.rs:8:5: 8:15
1010
debug self => _4; // in scope 1 at $SRC_DIR/alloc/src/boxed.rs:LL:COL
11-
let mut _5: &mut T; // in scope 1 at $DIR/issue-58867-inline-as-ref-as-mut.rs:8:5: 8:15
12-
let mut _6: &mut T; // in scope 1 at $DIR/issue-58867-inline-as-ref-as-mut.rs:8:5: 8:15
11+
let mut _5: &mut T; // in scope 1 at $SRC_DIR/alloc/src/boxed.rs:LL:COL
12+
let mut _6: &mut T; // in scope 1 at $SRC_DIR/alloc/src/boxed.rs:LL:COL
1313
}
1414

1515
bb0: {

src/test/mir-opt/inline/issue_76997_inline_scopes_parenting.main.Inline.after.mir

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ fn main() -> () {
1111
debug f => _1; // in scope 1 at $DIR/issue-76997-inline-scopes-parenting.rs:5:9: 5:10
1212
scope 2 (inlined main::{closure#0}) { // at $DIR/issue-76997-inline-scopes-parenting.rs:6:5: 6:10
1313
debug x => _6; // in scope 2 at $DIR/issue-76997-inline-scopes-parenting.rs:5:14: 5:15
14-
let _5: (); // in scope 2 at $DIR/issue-76997-inline-scopes-parenting.rs:6:5: 6:10
14+
let _5: (); // in scope 2 at $DIR/issue-76997-inline-scopes-parenting.rs:5:23: 5:24
1515
scope 3 {
1616
debug y => _5; // in scope 3 at $DIR/issue-76997-inline-scopes-parenting.rs:5:23: 5:24
1717
}

0 commit comments

Comments
 (0)