From 4287f5a77775be032de98a6b81f1ee9edd03fee7 Mon Sep 17 00:00:00 2001 From: Martin Nordholts Date: Thu, 14 Dec 2023 16:42:19 +0100 Subject: [PATCH] rustc_mir_build: Make non-exhaustive non-empty match diagnotics deterministic --- compiler/rustc_mir_build/src/thir/pattern/check_match.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/compiler/rustc_mir_build/src/thir/pattern/check_match.rs b/compiler/rustc_mir_build/src/thir/pattern/check_match.rs index 09e0b30a5c7..792a443c908 100644 --- a/compiler/rustc_mir_build/src/thir/pattern/check_match.rs +++ b/compiler/rustc_mir_build/src/thir/pattern/check_match.rs @@ -9,7 +9,7 @@ use crate::errors::*; use rustc_arena::TypedArena; use rustc_ast::Mutability; -use rustc_data_structures::fx::FxHashSet; +use rustc_data_structures::fx::FxIndexSet; use rustc_data_structures::stack::ensure_sufficient_stack; use rustc_errors::{struct_span_err, Applicability, DiagnosticBuilder, ErrorGuaranteed, MultiSpan}; use rustc_hir as hir; @@ -948,7 +948,7 @@ fn report_non_exhaustive_match<'p, 'tcx>( err.note(format!("the matched value is of type `{}`", scrut_ty)); if !is_empty_match { - let mut non_exhaustive_tys = FxHashSet::default(); + let mut non_exhaustive_tys = FxIndexSet::default(); // Look at the first witness. collect_non_exhaustive_tys(cx, &witnesses[0], &mut non_exhaustive_tys); @@ -1104,7 +1104,7 @@ fn joined_uncovered_patterns<'p, 'tcx>( fn collect_non_exhaustive_tys<'tcx>( cx: &MatchCheckCtxt<'_, 'tcx>, pat: &WitnessPat<'tcx>, - non_exhaustive_tys: &mut FxHashSet>, + non_exhaustive_tys: &mut FxIndexSet>, ) { if matches!(pat.ctor(), Constructor::NonExhaustive) { non_exhaustive_tys.insert(pat.ty());