about summary refs log tree commit diff
diff options
context:
space:
mode:
authorljedrz <ljedrz@gmail.com>2020-04-16 20:00:54 +0200
committerljedrz <ljedrz@gmail.com>2020-04-16 20:00:54 +0200
commit66575c9962188aa2f16df04fa1fef1786f0d216f (patch)
tree4612c856672023e212d68c67a42c7af83223fc5e
parent672b7682b0e836d87ad4e06e0fed2daaa6c065e6 (diff)
downloadrust-66575c9962188aa2f16df04fa1fef1786f0d216f.tar.gz
rust-66575c9962188aa2f16df04fa1fef1786f0d216f.zip
comment on the sorting of unused unsafe blocks
-rw-r--r--src/librustc_mir/transform/check_unsafety.rs2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/librustc_mir/transform/check_unsafety.rs b/src/librustc_mir/transform/check_unsafety.rs
index 567fa42c83a..9f6b1963ce7 100644
--- a/src/librustc_mir/transform/check_unsafety.rs
+++ b/src/librustc_mir/transform/check_unsafety.rs
@@ -649,6 +649,8 @@ pub fn check_unsafety(tcx: TyCtxt<'_>, def_id: DefId) {
             unsafe_unused.push(block_id);
         }
     }
+    // The unused unsafe blocks might not be in source order; sort them so that the unused unsafe
+    // error messages are properly aligned and the issue-45107 and lint-unused-unsafe tests pass.
     unsafe_unused.sort_by_cached_key(|hir_id| tcx.hir().span(*hir_id));
 
     for &block_id in &unsafe_unused {