Skip to content

Commit b24aa7c

Browse files
ecstatic-morseMark-Simulacrum
authored andcommitted
Make novel structural match violations a warning
1 parent 1dc0f6d commit b24aa7c

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

Lines changed: 5 additions & 1 deletion
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)