diff options
| author | Esteban Küber <esteban@kuber.com.ar> | 2019-01-08 16:32:52 -0800 |
|---|---|---|
| committer | Esteban Küber <esteban@kuber.com.ar> | 2019-01-12 19:36:28 -0800 |
| commit | 10fbdbf949f3ca171a52010eb2c53547c3e5b4f5 (patch) | |
| tree | 28f9e5479a96e13afb7fb9c1cd61cc089663aa6c | |
| parent | 486ecc5e27992175c194b5bb12a374d15293c9c0 (diff) | |
| download | rust-10fbdbf949f3ca171a52010eb2c53547c3e5b4f5.tar.gz rust-10fbdbf949f3ca171a52010eb2c53547c3e5b4f5.zip | |
Update documentation comment
| -rw-r--r-- | src/librustc_typeck/check/_match.rs | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/src/librustc_typeck/check/_match.rs b/src/librustc_typeck/check/_match.rs index 85292dc1f13..1767af4870d 100644 --- a/src/librustc_typeck/check/_match.rs +++ b/src/librustc_typeck/check/_match.rs @@ -20,10 +20,23 @@ use std::cmp; use super::report_unexpected_variant_def; impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { - /// The `is_arg` argument indicates whether this pattern is the - /// *outermost* pattern in an argument (e.g., in `fn foo(&x: - /// &u32)`, it is true for the `&x` pattern but not `x`). This is - /// used to tailor error reporting. + /// `match_discrim_span` argument having a `Span` indicates that this pattern is part of + /// a match expression arm guard, and it points to the match discriminant to add context + /// in type errors. In the folloowing example, `match_discrim_span` corresponds to the + /// `a + b` expression: + /// + /// ```text + /// error[E0308]: mismatched types + /// --> src/main.rs:5:9 + /// | + /// 4 | let temp: usize = match a + b { + /// | ----- this expression has type `usize` + /// 5 | Ok(num) => num, + /// | ^^^^^^^ expected usize, found enum `std::result::Result` + /// | + /// = note: expected type `usize` + /// found type `std::result::Result<_, _>` + /// ``` pub fn check_pat_walk( &self, pat: &'gcx hir::Pat, |
