Skip to main content

Module pat

Module pat 

Source

Re-exportsΒ§

use std::collections::hash_map::Entry::Occupied; πŸ”’
use std::collections::hash_map::Entry::Vacant; πŸ”’
use std::assert_matches; πŸ”’
use std::cmp; πŸ”’
use rustc_abi::FieldIdx; πŸ”’
use rustc_ast as ast; πŸ”’
use rustc_attr_ir::lang_items::LangItem; πŸ”’
use rustc_data_structures::fx::FxHashMap; πŸ”’
use rustc_errors::Applicability; πŸ”’
use rustc_errors::Diag; πŸ”’
use rustc_errors::DiagCtxtHandle; πŸ”’
use rustc_errors::Diagnostic; πŸ”’
use rustc_errors::ErrorGuaranteed; πŸ”’
use rustc_errors::Level; πŸ”’
use rustc_errors::MultiSpan; πŸ”’
use rustc_errors::pluralize; πŸ”’
use rustc_errors::struct_span_code_err; πŸ”’
use rustc_hir::def::CtorKind; πŸ”’
use rustc_hir::def::DefKind; πŸ”’
use rustc_hir::def::Res; πŸ”’
use rustc_hir::def_id::DefId; πŸ”’
use rustc_hir::pat_util::EnumerateAndAdjustIterator; πŸ”’
use rustc_hir as hir; πŸ”’
use rustc_hir::BindingMode; πŸ”’
use rustc_hir::ByRef; πŸ”’
use rustc_hir::ExprKind; πŸ”’
use rustc_hir::HirId; πŸ”’
use rustc_hir::Mutability; πŸ”’
use rustc_hir::Pat; πŸ”’
use rustc_hir::PatExpr; πŸ”’
use rustc_hir::PatExprKind; πŸ”’
use rustc_hir::PatKind; πŸ”’
use rustc_hir::expr_needs_parens; πŸ”’
use rustc_hir_analysis::autoderef::report_autoderef_recursion_limit_error; πŸ”’
use rustc_infer::infer::RegionVariableOrigin; πŸ”’
use rustc_lint_defs::builtin::NON_EXHAUSTIVE_OMITTED_PATTERNS; πŸ”’
use rustc_middle::traits::PatternOriginExpr; πŸ”’
use rustc_middle::ty; πŸ”’
use rustc_middle::ty::Pinnedness; πŸ”’
use rustc_middle::ty::Ty; πŸ”’
use rustc_middle::ty::TypeVisitableExt; πŸ”’
use rustc_middle::ty::Unnormalized; πŸ”’
use rustc_session::diagnostics::feature_err; πŸ”’
use rustc_span::edit_distance::find_best_match_for_name; πŸ”’
use rustc_span::edition::Edition; πŸ”’
use rustc_span::BytePos; πŸ”’
use rustc_span::DUMMY_SP; πŸ”’
use rustc_span::Ident; πŸ”’
use rustc_span::Span; πŸ”’
use rustc_span::bug; πŸ”’
use rustc_span::kw; πŸ”’
use rustc_span::span_bug; πŸ”’
use rustc_span::sym; πŸ”’
use rustc_trait_selection::infer::InferCtxtExt; πŸ”’
use rustc_trait_selection::traits::ObligationCause; πŸ”’
use rustc_trait_selection::traits::ObligationCauseCode; πŸ”’
use tracing::debug; πŸ”’
use tracing::instrument; πŸ”’
use tracing::instrument; πŸ”’
use tracing::trace; πŸ”’
use ty::VariantDef; πŸ”’
use ty::adjustment::PatAdjust; πŸ”’
use ty::adjustment::PatAdjustment; πŸ”’
use crate::expectation::Expectation; πŸ”’
use crate::gather_locals::DeclOrigin; πŸ”’
use crate::FnCtxt; πŸ”’
use crate::diagnostics; πŸ”’
use rustc_errors::codes::*; πŸ”’

StructsΒ§

PatInfo πŸ”’
ResolvedPat πŸ”’
When checking patterns containing paths, we need to know the path’s resolution to determine whether to apply match ergonomics and implicitly dereference the scrutinee. For instance, when the deref_patterns feature is enabled and we’re matching against a scrutinee of type Cow<'a, Option<u8>>, we insert an implicit dereference to allow the pattern Some(_) to type, but we must not dereference it when checking the pattern Cow::Borrowed(_).
TopInfo πŸ”’
Information about the expected type at the top level of type checking a pattern.

EnumsΒ§

AdjustMode πŸ”’
Mode for adjusting the expected type and binding mode.
InheritedRefMatchRule πŸ”’
Variations on RFC 3627’s Rule 4: when do reference patterns match against inherited references?
MutblCap πŸ”’
ref mut bindings (explicit or match-ergonomics) are not allowed behind an & reference. Normally, the borrow checker enforces this, but for (currently experimental) match ergonomics, we track this when typing patterns for two purposes:
PeelKind πŸ”’
Restrictions on what types to peel when adjusting the expected type and binding mode.
PinnednessCap πŸ”’
ref or ref mut bindings (not pinned, explicitly or match-ergonomics) are only allowed behind an &pin reference if the binding’s type is Unpin.
ResolvedPatKind πŸ”’

ConstantsΒ§

CANNOT_IMPLICITLY_DEREF_POINTER_TRAIT_OBJ πŸ”’

FunctionsΒ§

is_number πŸ”’