Skip to content

Commit 10ac7ea

Browse files
committed
document check_borrow_conflicts_in_at_patterns
1 parent b9aba74 commit 10ac7ea

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/librustc_mir/hair/pattern/check_match.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ fn pat_is_catchall(pat: &Pat) -> bool {
317317
}
318318
}
319319

320-
// Check for unreachable patterns
320+
/// Check for unreachable patterns.
321321
fn check_arms<'p, 'tcx>(
322322
cx: &mut MatchCheckCtxt<'p, 'tcx>,
323323
arms: &[(&'p super::Pat<'tcx>, &hir::Pat, bool)],
@@ -574,7 +574,7 @@ fn maybe_point_at_variant(ty: Ty<'_>, patterns: &[super::Pat<'_>]) -> Vec<Span>
574574
covered
575575
}
576576

577-
// Check the legality of legality of by-move bindings.
577+
/// Check the legality of legality of by-move bindings.
578578
fn check_legality_of_move_bindings(cx: &mut MatchVisitor<'_, '_>, has_guard: bool, pat: &Pat) {
579579
let sess = cx.tcx.sess;
580580
let tables = cx.tables;
@@ -630,6 +630,14 @@ fn check_legality_of_move_bindings(cx: &mut MatchVisitor<'_, '_>, has_guard: boo
630630
}
631631
}
632632

633+
/// Check that there are no borrow conflicts in `binding @ subpat` patterns.
634+
///
635+
/// For example, this would reject:
636+
/// - `ref x @ Some(ref mut y)`,
637+
/// - `ref mut x @ Some(ref y)`
638+
/// - `ref mut x @ Some(ref mut y)`.
639+
///
640+
/// This analysis is *not* subsumed by NLL.
633641
fn check_borrow_conflicts_in_at_patterns(cx: &MatchVisitor<'_, '_>, pat: &Pat) {
634642
let tab = cx.tables;
635643
let sess = cx.tcx.sess;

0 commit comments

Comments
 (0)