Skip to main content

Module expr_use_visitor

Module expr_use_visitor 

Source
Expand description

A different sort of visitor for walking fn bodies. Unlike the normal visitor, which just walks the entire body in one shot, the ExprUseVisitor determines how expressions are being used.

In the compiler, this is only used for upvar inference and diagnostics, but there are many uses within clippy.

Re-exportsยง

use std::cell::Ref; ๐Ÿ”’
use std::cell::RefCell; ๐Ÿ”’
use std::ops::Deref; ๐Ÿ”’
use hir::def::DefKind; ๐Ÿ”’
use hir::pat_util::EnumerateAndAdjustIterator as _; ๐Ÿ”’
use rustc_abi::FIRST_VARIANT; ๐Ÿ”’
use rustc_abi::FieldIdx; ๐Ÿ”’
use rustc_abi::VariantIdx; ๐Ÿ”’
use rustc_ast::UnsafeBinderCastKind; ๐Ÿ”’
use rustc_data_structures::fx::FxIndexMap; ๐Ÿ”’
use rustc_hir::def::CtorOf; ๐Ÿ”’
use rustc_hir::def::Res; ๐Ÿ”’
use rustc_hir::def_id::LocalDefId; ๐Ÿ”’
use rustc_hir as hir; ๐Ÿ”’
use rustc_hir::HirId; ๐Ÿ”’
use rustc_hir::PatExpr; ๐Ÿ”’
use rustc_hir::PatExprKind; ๐Ÿ”’
use rustc_hir::PatKind; ๐Ÿ”’
use rustc_lint::LateContext; ๐Ÿ”’
use rustc_middle::hir::place::ProjectionKind; ๐Ÿ”’
use rustc_middle::mir::FakeReadCause; ๐Ÿ”’
use rustc_middle::thir::DerefPatBorrowMode; ๐Ÿ”’
use rustc_middle::ty::adjustment::DerefAdjustKind; ๐Ÿ”’
use rustc_middle::ty; ๐Ÿ”’
use rustc_middle::ty::BorrowKind; ๐Ÿ”’
use rustc_middle::ty::Ty; ๐Ÿ”’
use rustc_middle::ty::TyCtxt; ๐Ÿ”’
use rustc_middle::ty::TypeFoldable; ๐Ÿ”’
use rustc_middle::ty::TypeVisitableExt as _; ๐Ÿ”’
use rustc_middle::ty::adjustment; ๐Ÿ”’
use rustc_span::ErrorGuaranteed; ๐Ÿ”’
use rustc_span::Span; ๐Ÿ”’
use rustc_span::bug; ๐Ÿ”’
use rustc_span::span_bug; ๐Ÿ”’
use rustc_trait_selection::infer::InferCtxtExt; ๐Ÿ”’
use tracing::debug; ๐Ÿ”’
use tracing::instrument; ๐Ÿ”’
use tracing::instrument; ๐Ÿ”’
use tracing::trace; ๐Ÿ”’
use crate::fn_ctxt::FnCtxt; ๐Ÿ”’

Structsยง

ExprPlaceDelegate ๐Ÿ”’
ExprUseVisitor
A visitor that reports how each expression is being used.
Place
A Place represents how a value is located in memory. This does not always correspond to a syntactic place expression. For example, when processing a pattern, a Place can be used to refer to the sub-value currently being inspected.
PlaceWithHirId
A PlaceWithHirId represents how a value is located in memory. This does not always correspond to a syntactic place expression. For example, when processing a pattern, a Place can be used to refer to the sub-value currently being inspected.
Projection

Enumsยง

PlaceBase

Traitsยง

Delegate
This trait defines the callbacks you can expect to receive when employing the ExprUseVisitor.
TypeInformationCtxt
This trait makes ExprUseVisitor usable with both FnCtxt and LateContext, depending on where in the compiler it is used.

Functionsยง

expr_place ๐Ÿ”’
Categorizes expr as a place for diagnostic suggestions.