Skip to content

Commit c9dc73d

Browse files
Make novel structural match violations a warning
1 parent e8ff4bc commit c9dc73d

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/librustc_mir_build/hair/pattern/const_to_pat.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,12 @@ impl<'a, 'tcx> ConstToPat<'a, 'tcx> {
107107
cv.ty, structural
108108
);
109109

110+
// This can occur because const qualification treats all associated constants as
111+
// opaque, whereas `search_for_structural_match_violation` tries to monomorphize them
112+
// before it runs. See #73431 for an example.
110113
if structural.is_none() && mir_structural_match_violation {
111-
bug!("MIR const-checker found novel structural match violation");
114+
warn!("MIR const-checker found novel structural match violation");
115+
return inlined_const_as_pat;
112116
}
113117

114118
if let Some(non_sm_ty) = structural {

0 commit comments

Comments
 (0)