Re-exportsยง
use std::borrow::Cow;๐use std::path::PathBuf;๐use std::debug_assert_matches;๐use std::iter;๐use itertools::EitherOrBoth;๐use itertools::Itertools;๐use rustc_attr_ir::lang_items;๐use rustc_attr_ir::lang_items::LangItem;๐use rustc_data_structures::fx::FxHashSet;๐use rustc_errors::Applicability;๐use rustc_errors::Diag;๐use rustc_errors::MultiSpan;๐use rustc_errors::Style;๐use rustc_errors::SuggestionStyle;๐use rustc_errors::pluralize;๐use rustc_errors::struct_span_code_err;๐use rustc_hir::def::CtorKind;๐use rustc_hir::def::CtorOf;๐use rustc_hir::def::DefKind;๐use rustc_hir::def::Res;๐use rustc_hir::def_id::DefId;๐use rustc_hir::intravisit::Visitor;๐use rustc_hir as hir;๐use rustc_hir::AmbigArg;๐use rustc_hir::CoroutineDesugaring;๐use rustc_hir::CoroutineKind;๐use rustc_hir::CoroutineSource;๐use rustc_hir::Expr;๐use rustc_hir::HirId;๐use rustc_hir::Node;๐use rustc_hir::expr_needs_parens;๐use rustc_infer::infer::BoundRegionConversionTime;๐use rustc_infer::infer::DefineOpaqueTypes;๐use rustc_infer::infer::InferCtxt;๐use rustc_infer::infer::InferOk;๐use rustc_infer::traits::ImplSource;๐use rustc_middle::middle::privacy::Level;๐use rustc_middle::traits::IsConstable;๐use rustc_middle::ty::adjustment::Adjust;๐use rustc_middle::ty::adjustment::DerefAdjustKind;๐use rustc_middle::ty::error::TypeError;๐use rustc_middle::ty::print::PrintPolyTraitClauseExt as _;๐use rustc_middle::ty::print::PrintPolyTraitRefExt;๐use rustc_middle::ty::print::PrintTraitClauseExt as _;๐use rustc_middle::ty::print::PrintTraitRefExt as _;๐use rustc_middle::ty::print::with_forced_trimmed_paths;๐use rustc_middle::ty::print::with_forced_trimmed_paths;๐use rustc_middle::ty::print::with_no_trimmed_paths;๐use rustc_middle::ty::print::with_no_trimmed_paths;๐use rustc_middle::ty::print::with_types_for_suggestion;๐use rustc_middle::ty;๐use rustc_middle::ty::AdtKind;๐use rustc_middle::ty::CallerBoundsIterator;๐use rustc_middle::ty::GenericArgs;๐use rustc_middle::ty::InferTy;๐use rustc_middle::ty::IsSuggestable;๐use rustc_middle::ty::Ty;๐use rustc_middle::ty::TyCtxt;๐use rustc_middle::ty::TypeFoldable;๐use rustc_middle::ty::TypeFolder;๐use rustc_middle::ty::TypeSuperFoldable;๐use rustc_middle::ty::TypeSuperVisitable;๐use rustc_middle::ty::TypeVisitableExt;๐use rustc_middle::ty::TypeVisitor;๐use rustc_middle::ty::TypeckResults;๐use rustc_middle::ty::Unnormalized;๐use rustc_middle::ty::Upcast;๐use rustc_middle::ty::suggest_arbitrary_trait_bound;๐use rustc_middle::ty::suggest_constraining_type_param;๐use rustc_span::def_id::LocalDefId;๐use rustc_span::BytePos;๐use rustc_span::DUMMY_SP;๐use rustc_span::DesugaringKind;๐use rustc_span::ExpnKind;๐use rustc_span::Ident;๐use rustc_span::MacroKind;๐use rustc_span::Span;๐use rustc_span::Symbol;๐use rustc_span::bug;๐use rustc_span::kw;๐use rustc_span::span_bug;๐use rustc_span::sym;๐use tracing::debug;๐use tracing::instrument;๐use tracing::instrument;๐use super::DefIdOrName;๐use super::FindExprBySpan;๐use super::ImplCandidate;๐use super::Obligation;๐use super::ObligationCause;๐use super::ObligationCauseCode;๐use super::PredicateObligation;๐use crate::diagnostics;๐use crate::error_reporting::TypeErrCtxt;๐use crate::infer::InferCtxtExt as _;๐use crate::traits::query::evaluate_obligation::InferCtxtExt as _;๐use crate::traits::ImplDerivedCause;๐use crate::traits::NormalizeExt;๐use crate::traits::ObligationCtxt;๐use crate::traits::SelectionContext;๐use rustc_errors::codes::*;๐
Structsยง
- Awaits
Visitor ๐ - Collect all the awaited expressions within the input expression.
- Coroutine
Data ๐ - Find
Type ๐Param - Look for type
paramin an ADT being used only through a reference to confirm that suggestingparam: ?Sizedwould be a valid constraint. - Param
Finder ๐ - Look for type parameters in predicates. We use this to identify whether a bound is suitable in on a given item.
- Peeled
Ref ๐ - A single layer of
&peeled from an expression, used byTypeErrCtxt::peel_expr_refs. - Replace
Impl ๐Trait Folder - Replace
Impl ๐Trait Visitor - Collect the spans that we see the generic param
param_did - Returns
Visitor - Collect all the returned expressions within the input expression. Used to point at the return spans when we want to suggest some change to them.
- Self
Visitor - Collect all the paths that reference
Self. Used to suggest replacing associated types with an explicit type inwhereclauses.
Enumsยง
Traitsยง
- Next
Type Param Name - Suggest a new type parameter name for diagnostic purposes.
Functionsยง
- get_
deref_ ๐type_ and_ refs - get_
explanation_ ๐based_ on_ obligation - hint_
missing_ ๐borrow - Add a hint to add a missing borrow or remove an unnecessary one.
- point_
at_ ๐assoc_ type_ restriction - On
implevaluation cycles, look forSelf::AssocTyrestrictions inwhereclauses, explain they are not allowed and if possible suggest alternatives. - predicate_
constraint ๐ - suggest_
desugaring_ async_ fn_ to_ impl_ future_ in_ trait - suggest_
restriction - Type parameter needs more bounds. The trivial case is
Twhere T: Bound, but it can also be animpl Traitparam that needs to be decomposed to a type param for cleaner code.