From 5402e4833ff1a23218ae77456488d873e261591a Mon Sep 17 00:00:00 2001 From: Esteban Kuber Date: Tue, 14 Sep 2021 11:39:49 +0000 Subject: Sort `FxHashSet`'s contents before emitting errors for consistent output --- compiler/rustc_interface/src/passes.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'compiler/rustc_interface/src') diff --git a/compiler/rustc_interface/src/passes.rs b/compiler/rustc_interface/src/passes.rs index 67b5833ca47..d3917dfb14a 100644 --- a/compiler/rustc_interface/src/passes.rs +++ b/compiler/rustc_interface/src/passes.rs @@ -452,7 +452,10 @@ pub fn configure_and_expand( // Gate identifiers containing invalid Unicode codepoints that were recovered during lexing. sess.parse_sess.bad_unicode_identifiers.with_lock(|identifiers| { - for (ident, spans) in identifiers.drain() { + let mut identifiers: Vec<_> = identifiers.drain().collect(); + identifiers.sort_by_key(|&(key, _)| key); + for (ident, mut spans) in identifiers.into_iter() { + spans.sort(); sess.diagnostic().span_err( MultiSpan::from(spans), &format!("identifiers cannot contain emoji: `{}`", ident), -- cgit 1.4.1-3-g733a5