about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorMazdak Farrokhzad <twingoow@gmail.com>2019-12-15 13:16:29 +0100
committerMazdak Farrokhzad <twingoow@gmail.com>2019-12-15 13:16:29 +0100
commit66bb978ab65f7c7e1d6c39e275baf8eb22b1a04d (patch)
tree2249aedcc8da22f97d16e5588dd6b98dd710bb9b /src
parentd848ce0ddf4f20bd6fbae70ad126640247f61a56 (diff)
downloadrust-66bb978ab65f7c7e1d6c39e275baf8eb22b1a04d.tar.gz
rust-66bb978ab65f7c7e1d6c39e275baf8eb22b1a04d.zip
improve hir::PatKind::Slice docs
Diffstat (limited to 'src')
-rw-r--r--src/librustc/hir/mod.rs11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/librustc/hir/mod.rs b/src/librustc/hir/mod.rs
index 66bb3a8d883..6b354b01518 100644
--- a/src/librustc/hir/mod.rs
+++ b/src/librustc/hir/mod.rs
@@ -1048,8 +1048,15 @@ pub enum PatKind {
     /// A range pattern (e.g., `1..=2` or `1..2`).
     Range(P<Expr>, P<Expr>, RangeEnd),
 
-    /// `[a, b, ..i, y, z]` is represented as:
-    ///     `PatKind::Slice(box [a, b], Some(i), box [y, z])`.
+    /// A slice pattern, `[before_0, ..., before_n, (slice, after_0, ..., after_n)?]`.
+    ///
+    /// Here, `slice` is lowered from the syntax `($binding_mode $ident @)? ..`.
+    /// If `slice` exists, then `after` can be non-empty.
+    ///
+    /// The representation for e.g., `[a, b, .., c, d]` is:
+    /// ```
+    /// PatKind::Slice([Binding(a), Binding(b)], Some(Wild), [Binding(c), Binding(d)])
+    /// ```
     Slice(HirVec<P<Pat>>, Option<P<Pat>>, HirVec<P<Pat>>),
 }