Skip to content

Commit

Permalink
comment on the sorting of unused unsafe blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
ljedrz committed Apr 16, 2020
1 parent 672b768 commit 66575c9
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/librustc_mir/transform/check_unsafety.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 66575c9

Please sign in to comment.