@@ -27,11 +27,12 @@ use rustc_span::Span;
2727/// employing the ExprUseVisitor.
2828pub trait Delegate < ' tcx > {
2929 // The value found at `place` is either copied or moved, depending
30- // on mode. Where `diag_expr_id` is the id used for diagnostics for `place`.
30+ // on ` mode` . Where `diag_expr_id` is the id used for diagnostics for `place`.
3131 //
32- // The reson for a separate expr_id for diagonostics is to support cases
33- // like `let pat = upvar`, in such scenarios reporting the pattern (lhs)
34- // looks confusing. Instead we prefer to report the discriminant (rhs)
32+ // The parameter `diag_expr_id` indicates the HIR id that ought to be used for
33+ // diagnostics. Around pattern matching such as `let pat = expr`, the diagnostic
34+ // id will be the id of the expression `expr` but the place itself will have
35+ // the id of the binding in the pattern `pat`.
3536 fn consume (
3637 & mut self ,
3738 place_with_id : & PlaceWithHirId < ' tcx > ,
@@ -40,11 +41,7 @@ pub trait Delegate<'tcx> {
4041 ) ;
4142
4243 // The value found at `place` is being borrowed with kind `bk`.
43- // `diag_expr_id` is the id used for diagnostics for `place`.
44- //
45- // The reson for a separate expr_id for diagonostics is to support cases
46- // like `let pat = upvar`, in such scenarios reporting the pattern (lhs)
47- // looks confusing. Instead we prefer to report the discriminant (rhs)
44+ // `diag_expr_id` is the id used for diagnostics (see `consume` for more details).
4845 fn borrow (
4946 & mut self ,
5047 place_with_id : & PlaceWithHirId < ' tcx > ,
@@ -53,11 +50,7 @@ pub trait Delegate<'tcx> {
5350 ) ;
5451
5552 // The path at `assignee_place` is being assigned to.
56- // `diag_expr_id` is the id used for diagnostics for `place`.
57- //
58- // The reson for a separate expr_id for diagonostics is to support cases
59- // like `let pat = upvar`, in such scenarios reporting the pattern (lhs)
60- // looks confusing. Instead we prefer to report the discriminant (rhs)
53+ // `diag_expr_id` is the id used for diagnostics (see `consume` for more details).
6154 fn mutate ( & mut self , assignee_place : & PlaceWithHirId < ' tcx > , diag_expr_id : hir:: HirId ) ;
6255}
6356
0 commit comments