Skip to content

Commit bfa0e1e

Browse files
committed
Add debug-assertions for assumptions about enabled typing rules
1 parent 48e023a commit bfa0e1e

File tree

1 file changed

+2
-0
lines changed
  • compiler/rustc_hir_typeck/src

1 file changed

+2
-0
lines changed

Diff for: compiler/rustc_hir_typeck/src/pat.rs

+2
Original file line numberDiff line numberDiff line change
@@ -2290,6 +2290,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
22902290
// NB: This assumes that `&` patterns can match against mutable references
22912291
// (RFC 3627, Rule 5). If we implement a pattern typing ruleset with Rule 4E
22922292
// but not Rule 5, we'll need to check that here.
2293+
debug_assert!(ref_pat_matches_mut_ref);
22932294
let err_msg = "mismatched types";
22942295
let err = if let Some(span) = pat_prefix_span {
22952296
let mut err = self.dcx().struct_span_err(span, err_msg);
@@ -2326,6 +2327,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
23262327
// NB: This assumes that `&` patterns can match against mutable
23272328
// references (RFC 3627, Rule 5). If we implement a pattern typing
23282329
// ruleset with Rule 4 but not Rule 5, we'll need to check that here.
2330+
debug_assert!(ref_pat_matches_mut_ref);
23292331
} else {
23302332
pat_info.binding_mode = ByRef::No;
23312333
self.typeck_results

0 commit comments

Comments
 (0)