about summary refs log tree commit diff
diff options
context:
space:
mode:
authorDhruv Jauhar <dhruvjhr@gmail.com>2020-11-04 02:54:00 -0500
committerDhruv Jauhar <dhruvjhr@gmail.com>2020-11-04 02:54:00 -0500
commitc9d9359b00b20cd0a2b07b044098a3318bd3292b (patch)
treef92a5d73e09d37bba761c20ceb1754beb3fa1186
parent1f53754236b654d3a4edbf5cb28cfe24f4e3fe26 (diff)
Address Pr comments regarding docstrings
-rw-r--r--compiler/rustc_typeck/src/expr_use_visitor.rs21
1 files changed, 7 insertions, 14 deletions
diff --git a/compiler/rustc_typeck/src/expr_use_visitor.rs b/compiler/rustc_typeck/src/expr_use_visitor.rs
index d74893bda28..57bd89b9d3d 100644
--- a/compiler/rustc_typeck/src/expr_use_visitor.rs
+++ b/compiler/rustc_typeck/src/expr_use_visitor.rs
@@ -27,11 +27,12 @@ use rustc_span::Span;
 /// employing the ExprUseVisitor.
 pub trait Delegate<'tcx> {
     // The value found at `place` is either copied or moved, depending
-    // on mode. Where `diag_expr_id` is the id used for diagnostics for `place`.
+    // on `mode`. Where `diag_expr_id` is the id used for diagnostics for `place`.
     //
-    // The reson for a separate expr_id for diagonostics is to support cases
-    // like `let pat = upvar`, in such scenarios reporting the pattern (lhs)
-    // looks confusing. Instead we prefer to report the discriminant (rhs)
+    // The parameter `diag_expr_id` indicates the HIR id that ought to be used for
+    // diagnostics. Around pattern matching such as `let pat = expr`, the diagnostic
+    // id will be the id of the expression `expr` but the place itself will have
+    // the id of the binding in the pattern `pat`.
     fn consume(
         &mut self,
         place_with_id: &PlaceWithHirId<'tcx>,
@@ -40,11 +41,7 @@ pub trait Delegate<'tcx> {
     );
 
     // The value found at `place` is being borrowed with kind `bk`.
-    // `diag_expr_id` is the id used for diagnostics for `place`.
-    //
-    // The reson for a separate expr_id for diagonostics is to support cases
-    // like `let pat = upvar`, in such scenarios reporting the pattern (lhs)
-    // looks confusing. Instead we prefer to report the discriminant (rhs)
+    // `diag_expr_id` is the id used for diagnostics (see `consume` for more details).
     fn borrow(
         &mut self,
         place_with_id: &PlaceWithHirId<'tcx>,
@@ -53,11 +50,7 @@ pub trait Delegate<'tcx> {
     );
 
     // The path at `assignee_place` is being assigned to.
-    // `diag_expr_id` is the id used for diagnostics for `place`.
-    //
-    // The reson for a separate expr_id for diagonostics is to support cases
-    // like `let pat = upvar`, in such scenarios reporting the pattern (lhs)
-    // looks confusing. Instead we prefer to report the discriminant (rhs)
+    // `diag_expr_id` is the id used for diagnostics (see `consume` for more details).
     fn mutate(&mut self, assignee_place: &PlaceWithHirId<'tcx>, diag_expr_id: hir::HirId);
 }