about summary refs log tree commit diff
diff options
context:
space:
mode:
authorYuki Okushi <jtitor@2k36.org>2021-06-12 01:15:59 +0900
committerGitHub <noreply@github.com>2021-06-12 01:15:59 +0900
commit79c0559ce154fc18b0d0a4601671484160690dd3 (patch)
tree3ec8ae9a2cf113c0e18ca6a66525c75e0f6225ae
parent883e1a5fd4f84556ae3fcea81d795d452fca6720 (diff)
parentfab319be73bac3773eb467139501b89b6ae3d13b (diff)
downloadrust-79c0559ce154fc18b0d0a4601671484160690dd3.tar.gz
rust-79c0559ce154fc18b0d0a4601671484160690dd3.zip
Rollup merge of #86153 - tmiasko:dummy-span, r=estebank
Print dummy spans as `no-location`

Fixes #58808.
-rw-r--r--compiler/rustc_span/src/source_map.rs2
-rw-r--r--src/test/mir-opt/generator_storage_dead_unwind.main-{closure#0}.StateTransform.before.mir4
-rw-r--r--src/test/mir-opt/loop_test.main.SimplifyCfg-promote-consts.after.mir2
-rw-r--r--src/test/mir-opt/match_arm_scopes.complicated_match.SimplifyCfg-initial.after-ElaborateDrops.after.diff8
-rw-r--r--src/test/mir-opt/while_storage.while_loop.PreCodegen.after.mir2
5 files changed, 9 insertions, 9 deletions
diff --git a/compiler/rustc_span/src/source_map.rs b/compiler/rustc_span/src/source_map.rs
index 0dadd419200..1d45cd172b3 100644
--- a/compiler/rustc_span/src/source_map.rs
+++ b/compiler/rustc_span/src/source_map.rs
@@ -407,7 +407,7 @@ impl SourceMap {
     }
 
     fn span_to_string(&self, sp: Span, prefer_local: bool) -> String {
-        if self.files.borrow().source_files.is_empty() && sp.is_dummy() {
+        if self.files.borrow().source_files.is_empty() || sp.is_dummy() {
             return "no-location".to_string();
         }
 
diff --git a/src/test/mir-opt/generator_storage_dead_unwind.main-{closure#0}.StateTransform.before.mir b/src/test/mir-opt/generator_storage_dead_unwind.main-{closure#0}.StateTransform.before.mir
index 42b95b5c68c..296a459b99f 100644
--- a/src/test/mir-opt/generator_storage_dead_unwind.main-{closure#0}.StateTransform.before.mir
+++ b/src/test/mir-opt/generator_storage_dead_unwind.main-{closure#0}.StateTransform.before.mir
@@ -85,13 +85,13 @@ yields ()
     bb8 (cleanup): {
         StorageDead(_10);                // scope 2 at $DIR/generator-storage-dead-unwind.rs:27:15: 27:16
         StorageDead(_9);                 // scope 2 at $DIR/generator-storage-dead-unwind.rs:27:16: 27:17
-        goto -> bb10;                    // scope 2 at $DIR/generator-storage-dead-unwind.rs:1:1: 1:1
+        goto -> bb10;                    // scope 2 at no-location
     }
 
     bb9 (cleanup): {
         StorageDead(_8);                 // scope 2 at $DIR/generator-storage-dead-unwind.rs:26:15: 26:16
         StorageDead(_7);                 // scope 2 at $DIR/generator-storage-dead-unwind.rs:26:16: 26:17
-        goto -> bb10;                    // scope 2 at $DIR/generator-storage-dead-unwind.rs:1:1: 1:1
+        goto -> bb10;                    // scope 2 at no-location
     }
 
     bb10 (cleanup): {
diff --git a/src/test/mir-opt/loop_test.main.SimplifyCfg-promote-consts.after.mir b/src/test/mir-opt/loop_test.main.SimplifyCfg-promote-consts.after.mir
index 99c7ac8d5b7..db88f77bb63 100644
--- a/src/test/mir-opt/loop_test.main.SimplifyCfg-promote-consts.after.mir
+++ b/src/test/mir-opt/loop_test.main.SimplifyCfg-promote-consts.after.mir
@@ -43,7 +43,7 @@ fn main() -> () {
         _6 = const 1_i32;                // scope 0 at $DIR/loop_test.rs:14:17: 14:18
         FakeRead(ForLet(None), _6);      // scope 0 at $DIR/loop_test.rs:14:13: 14:14
         StorageDead(_6);                 // scope 0 at $DIR/loop_test.rs:16:5: 16:6
-        goto -> bb3;                     // scope 0 at $DIR/loop_test.rs:1:1: 1:1
+        goto -> bb3;                     // scope 0 at no-location
     }
 
     bb5 (cleanup): {
diff --git a/src/test/mir-opt/match_arm_scopes.complicated_match.SimplifyCfg-initial.after-ElaborateDrops.after.diff b/src/test/mir-opt/match_arm_scopes.complicated_match.SimplifyCfg-initial.after-ElaborateDrops.after.diff
index 3395cbfbdfb..feb25035ee0 100644
--- a/src/test/mir-opt/match_arm_scopes.complicated_match.SimplifyCfg-initial.after-ElaborateDrops.after.diff
+++ b/src/test/mir-opt/match_arm_scopes.complicated_match.SimplifyCfg-initial.after-ElaborateDrops.after.diff
@@ -94,8 +94,8 @@
           _0 = const 3_i32;                // scope 0 at $DIR/match-arm-scopes.rs:15:59: 15:60
           StorageDead(_10);                // scope 0 at $DIR/match-arm-scopes.rs:15:72: 15:73
           StorageDead(_9);                 // scope 0 at $DIR/match-arm-scopes.rs:15:77: 15:78
--         goto -> bb23;                    // scope 0 at $DIR/match-arm-scopes.rs:1:1: 1:1
-+         goto -> bb20;                    // scope 0 at $DIR/match-arm-scopes.rs:1:1: 1:1
+-         goto -> bb23;                    // scope 0 at no-location
++         goto -> bb20;                    // scope 0 at no-location
       }
   
 -     bb10: {
@@ -150,8 +150,8 @@
           _0 = const 3_i32;                // scope 0 at $DIR/match-arm-scopes.rs:15:59: 15:60
           StorageDead(_13);                // scope 0 at $DIR/match-arm-scopes.rs:15:72: 15:73
           StorageDead(_12);                // scope 0 at $DIR/match-arm-scopes.rs:15:77: 15:78
--         goto -> bb23;                    // scope 0 at $DIR/match-arm-scopes.rs:1:1: 1:1
-+         goto -> bb20;                    // scope 0 at $DIR/match-arm-scopes.rs:1:1: 1:1
+-         goto -> bb23;                    // scope 0 at no-location
++         goto -> bb20;                    // scope 0 at no-location
       }
   
 -     bb15: {
diff --git a/src/test/mir-opt/while_storage.while_loop.PreCodegen.after.mir b/src/test/mir-opt/while_storage.while_loop.PreCodegen.after.mir
index b91aae054de..bf9c2d138a0 100644
--- a/src/test/mir-opt/while_storage.while_loop.PreCodegen.after.mir
+++ b/src/test/mir-opt/while_storage.while_loop.PreCodegen.after.mir
@@ -40,7 +40,7 @@ fn while_loop(_1: bool) -> () {
 
     bb4: {
         StorageDead(_4);                 // scope 0 at $DIR/while-storage.rs:13:9: 13:10
-        goto -> bb6;                     // scope 0 at $DIR/while-storage.rs:1:1: 1:1
+        goto -> bb6;                     // scope 0 at no-location
     }
 
     bb5: {