about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorMazdak Farrokhzad <twingoow@gmail.com>2019-12-14 23:57:20 +0100
committerMazdak Farrokhzad <twingoow@gmail.com>2019-12-23 14:47:19 +0100
commit10ac7ea127bbef189f71befafbb7faf3489a9d41 (patch)
treecb3e1ae2c1cdafbcf93663edee1be15e98cf83ff /src
parentb9aba749cfc192422d879b12c7a5c3674f5ad110 (diff)
downloadrust-10ac7ea127bbef189f71befafbb7faf3489a9d41.tar.gz
rust-10ac7ea127bbef189f71befafbb7faf3489a9d41.zip
document check_borrow_conflicts_in_at_patterns
Diffstat (limited to 'src')
-rw-r--r--src/librustc_mir/hair/pattern/check_match.rs12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/librustc_mir/hair/pattern/check_match.rs b/src/librustc_mir/hair/pattern/check_match.rs
index 30501e4504d..8abe3508fd6 100644
--- a/src/librustc_mir/hair/pattern/check_match.rs
+++ b/src/librustc_mir/hair/pattern/check_match.rs
@@ -317,7 +317,7 @@ fn pat_is_catchall(pat: &Pat) -> bool {
     }
 }
 
-// Check for unreachable patterns
+/// Check for unreachable patterns.
 fn check_arms<'p, 'tcx>(
     cx: &mut MatchCheckCtxt<'p, 'tcx>,
     arms: &[(&'p super::Pat<'tcx>, &hir::Pat, bool)],
@@ -574,7 +574,7 @@ fn maybe_point_at_variant(ty: Ty<'_>, patterns: &[super::Pat<'_>]) -> Vec<Span>
     covered
 }
 
-// Check the legality of legality of by-move bindings.
+/// Check the legality of legality of by-move bindings.
 fn check_legality_of_move_bindings(cx: &mut MatchVisitor<'_, '_>, has_guard: bool, pat: &Pat) {
     let sess = cx.tcx.sess;
     let tables = cx.tables;
@@ -630,6 +630,14 @@ fn check_legality_of_move_bindings(cx: &mut MatchVisitor<'_, '_>, has_guard: boo
     }
 }
 
+/// Check that there are no borrow conflicts in `binding @ subpat` patterns.
+///
+/// For example, this would reject:
+/// - `ref x @ Some(ref mut y)`,
+/// - `ref mut x @ Some(ref y)`
+/// - `ref mut x @ Some(ref mut y)`.
+///
+/// This analysis is *not* subsumed by NLL.
 fn check_borrow_conflicts_in_at_patterns(cx: &MatchVisitor<'_, '_>, pat: &Pat) {
     let tab = cx.tables;
     let sess = cx.tcx.sess;