@@ -27,11 +27,12 @@ use rustc_span::Span;
27
27
/// employing the ExprUseVisitor.
28
28
pub trait Delegate < ' tcx > {
29
29
// 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`.
31
31
//
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`.
35
36
fn consume (
36
37
& mut self ,
37
38
place_with_id : & PlaceWithHirId < ' tcx > ,
@@ -40,11 +41,7 @@ pub trait Delegate<'tcx> {
40
41
) ;
41
42
42
43
// 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).
48
45
fn borrow (
49
46
& mut self ,
50
47
place_with_id : & PlaceWithHirId < ' tcx > ,
@@ -53,11 +50,7 @@ pub trait Delegate<'tcx> {
53
50
) ;
54
51
55
52
// 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).
61
54
fn mutate ( & mut self , assignee_place : & PlaceWithHirId < ' tcx > , diag_expr_id : hir:: HirId ) ;
62
55
}
63
56
0 commit comments