Skip to content

Commit 66575c9

Browse files
committed
comment on the sorting of unused unsafe blocks
1 parent 672b768 commit 66575c9

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/librustc_mir/transform/check_unsafety.rs

+2
Original file line numberDiff line numberDiff line change
@@ -649,6 +649,8 @@ pub fn check_unsafety(tcx: TyCtxt<'_>, def_id: DefId) {
649649
unsafe_unused.push(block_id);
650650
}
651651
}
652+
// The unused unsafe blocks might not be in source order; sort them so that the unused unsafe
653+
// error messages are properly aligned and the issue-45107 and lint-unused-unsafe tests pass.
652654
unsafe_unused.sort_by_cached_key(|hir_id| tcx.hir().span(*hir_id));
653655

654656
for &block_id in &unsafe_unused {

0 commit comments

Comments
 (0)