pub trait Delegate<'tcx> {
    fn consume(
        &mut self,
        place_with_id: &PlaceWithHirId<'tcx>,
        diag_expr_id: HirId
    ); fn borrow(
        &mut self,
        place_with_id: &PlaceWithHirId<'tcx>,
        diag_expr_id: HirId,
        bk: BorrowKind
    ); fn mutate(
        &mut self,
        assignee_place: &PlaceWithHirId<'tcx>,
        diag_expr_id: HirId
    ); fn fake_read(
        &mut self,
        place_with_id: &PlaceWithHirId<'tcx>,
        cause: FakeReadCause,
        diag_expr_id: HirId
    ); fn copy(&mut self, place_with_id: &PlaceWithHirId<'tcx>, diag_expr_id: HirId) { ... } fn bind(&mut self, binding_place: &PlaceWithHirId<'tcx>, diag_expr_id: HirId) { ... } }
Expand description

This trait defines the callbacks you can expect to receive when employing the ExprUseVisitor.

Required Methods

The value found at place is moved, depending on mode. Where diag_expr_id is the id used for diagnostics for place.

Use of a Copy type in a ByValue context is considered a use by ImmBorrow and borrow is called instead. This is because a shared borrow is the “minimum access” that would be needed to perform a copy.

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.

The value found at place is being borrowed with kind bk. diag_expr_id is the id used for diagnostics (see consume for more details).

The path at assignee_place is being assigned to. diag_expr_id is the id used for diagnostics (see consume for more details).

The place should be a fake read because of specified cause.

Provided Methods

The value found at place is being copied. diag_expr_id is the id used for diagnostics (see consume for more details).

The path at binding_place is a binding that is being initialized.

This covers cases such as let x = 42;

Implementors