From c9dc73d757003c58430d759b6e567afa356470a7 Mon Sep 17 00:00:00 2001 From: Dylan MacKenzie Date: Wed, 17 Jun 2020 09:29:33 -0700 Subject: [PATCH] Make novel structural match violations a warning --- src/librustc_mir_build/hair/pattern/const_to_pat.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/librustc_mir_build/hair/pattern/const_to_pat.rs b/src/librustc_mir_build/hair/pattern/const_to_pat.rs index 087c2c064cf..8c4230dfa5d 100644 --- a/src/librustc_mir_build/hair/pattern/const_to_pat.rs +++ b/src/librustc_mir_build/hair/pattern/const_to_pat.rs @@ -107,8 +107,12 @@ impl<'a, 'tcx> ConstToPat<'a, 'tcx> { cv.ty, structural ); + // This can occur because const qualification treats all associated constants as + // opaque, whereas `search_for_structural_match_violation` tries to monomorphize them + // before it runs. See #73431 for an example. if structural.is_none() && mir_structural_match_violation { - bug!("MIR const-checker found novel structural match violation"); + warn!("MIR const-checker found novel structural match violation"); + return inlined_const_as_pat; } if let Some(non_sm_ty) = structural {