Skip to content

Commit fab319b

Browse files
committed
Print dummy spans as no-location
1 parent ed597e7 commit fab319b

5 files changed

+9
-9
lines changed

compiler/rustc_span/src/source_map.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ impl SourceMap {
407407
}
408408

409409
fn span_to_string(&self, sp: Span, prefer_local: bool) -> String {
410-
if self.files.borrow().source_files.is_empty() && sp.is_dummy() {
410+
if self.files.borrow().source_files.is_empty() || sp.is_dummy() {
411411
return "no-location".to_string();
412412
}
413413

src/test/mir-opt/generator_storage_dead_unwind.main-{closure#0}.StateTransform.before.mir

+2-2
Original file line numberDiff line numberDiff line change
@@ -85,13 +85,13 @@ yields ()
8585
bb8 (cleanup): {
8686
StorageDead(_10); // scope 2 at $DIR/generator-storage-dead-unwind.rs:27:15: 27:16
8787
StorageDead(_9); // scope 2 at $DIR/generator-storage-dead-unwind.rs:27:16: 27:17
88-
goto -> bb10; // scope 2 at $DIR/generator-storage-dead-unwind.rs:1:1: 1:1
88+
goto -> bb10; // scope 2 at no-location
8989
}
9090

9191
bb9 (cleanup): {
9292
StorageDead(_8); // scope 2 at $DIR/generator-storage-dead-unwind.rs:26:15: 26:16
9393
StorageDead(_7); // scope 2 at $DIR/generator-storage-dead-unwind.rs:26:16: 26:17
94-
goto -> bb10; // scope 2 at $DIR/generator-storage-dead-unwind.rs:1:1: 1:1
94+
goto -> bb10; // scope 2 at no-location
9595
}
9696

9797
bb10 (cleanup): {

src/test/mir-opt/loop_test.main.SimplifyCfg-promote-consts.after.mir

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ fn main() -> () {
4343
_6 = const 1_i32; // scope 0 at $DIR/loop_test.rs:14:17: 14:18
4444
FakeRead(ForLet(None), _6); // scope 0 at $DIR/loop_test.rs:14:13: 14:14
4545
StorageDead(_6); // scope 0 at $DIR/loop_test.rs:16:5: 16:6
46-
goto -> bb3; // scope 0 at $DIR/loop_test.rs:1:1: 1:1
46+
goto -> bb3; // scope 0 at no-location
4747
}
4848

4949
bb5 (cleanup): {

src/test/mir-opt/match_arm_scopes.complicated_match.SimplifyCfg-initial.after-ElaborateDrops.after.diff

+4-4
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,8 @@
9494
_0 = const 3_i32; // scope 0 at $DIR/match-arm-scopes.rs:15:59: 15:60
9595
StorageDead(_10); // scope 0 at $DIR/match-arm-scopes.rs:15:72: 15:73
9696
StorageDead(_9); // scope 0 at $DIR/match-arm-scopes.rs:15:77: 15:78
97-
- goto -> bb23; // scope 0 at $DIR/match-arm-scopes.rs:1:1: 1:1
98-
+ goto -> bb20; // scope 0 at $DIR/match-arm-scopes.rs:1:1: 1:1
97+
- goto -> bb23; // scope 0 at no-location
98+
+ goto -> bb20; // scope 0 at no-location
9999
}
100100

101101
- bb10: {
@@ -150,8 +150,8 @@
150150
_0 = const 3_i32; // scope 0 at $DIR/match-arm-scopes.rs:15:59: 15:60
151151
StorageDead(_13); // scope 0 at $DIR/match-arm-scopes.rs:15:72: 15:73
152152
StorageDead(_12); // scope 0 at $DIR/match-arm-scopes.rs:15:77: 15:78
153-
- goto -> bb23; // scope 0 at $DIR/match-arm-scopes.rs:1:1: 1:1
154-
+ goto -> bb20; // scope 0 at $DIR/match-arm-scopes.rs:1:1: 1:1
153+
- goto -> bb23; // scope 0 at no-location
154+
+ goto -> bb20; // scope 0 at no-location
155155
}
156156

157157
- bb15: {

src/test/mir-opt/while_storage.while_loop.PreCodegen.after.mir

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ fn while_loop(_1: bool) -> () {
4040

4141
bb4: {
4242
StorageDead(_4); // scope 0 at $DIR/while-storage.rs:13:9: 13:10
43-
goto -> bb6; // scope 0 at $DIR/while-storage.rs:1:1: 1:1
43+
goto -> bb6; // scope 0 at no-location
4444
}
4545

4646
bb5: {

0 commit comments

Comments
 (0)