Skip to main content

Module util

Module util 

Source

Re-exportsΒ§

use std::collections::VecDeque; πŸ”’
use rustc_attr_ir::lang_items::LangItem; πŸ”’
use rustc_data_structures::fx::FxHashSet; πŸ”’
use rustc_hir::def_id::DefId; πŸ”’
use rustc_infer::infer::InferCtxt; πŸ”’
use rustc_infer::traits::PolyTraitObligation; πŸ”’
use rustc_middle::ty::fast_reject::DeepRejectCtxt; πŸ”’
use rustc_middle::ty; πŸ”’
use rustc_middle::ty::CallerBoundsIterator; πŸ”’
use rustc_middle::ty::ClausePolarity; πŸ”’
use rustc_middle::ty::PolyTraitClause; πŸ”’
use rustc_middle::ty::SizedTraitKind; πŸ”’
use rustc_middle::ty::TraitClause; πŸ”’
use rustc_middle::ty::TraitRef; πŸ”’
use rustc_middle::ty::Ty; πŸ”’
use rustc_middle::ty::TyCtxt; πŸ”’
use rustc_middle::ty::TypeFoldable; πŸ”’
use rustc_middle::ty::TypeVisitableExt; πŸ”’
use rustc_middle::ty::Unnormalized; πŸ”’
use rustc_span::Span; πŸ”’
use smallvec::SmallVec; πŸ”’
use smallvec::smallvec; πŸ”’
use tracing::debug; πŸ”’

StructsΒ§

BoundVarReplacer
ClauseWithSupertraitSpan
Elaborator
β€œElaboration” is the process of identifying all the predicates that are implied by a source predicate. Currently, this basically means walking the β€œsupertraits” and other similar assumptions. For example, if we know that T: Ord, the elaborator would deduce that T: PartialOrd holds as well. Similarly, if we have trait Foo: 'static, and we know that T: Foo, then we know that T: 'static.
FilterToTraits
A filter around an iterator of predicates that makes it yield up just trait references.
PlaceholderReplacer
The inverse of BoundVarReplacer: replaces placeholders with the bound vars from which they came.
PredicateSet

EnumsΒ§

TupleArgumentsFlag πŸ”’

TraitsΒ§

Elaboratable
Describes how to elaborate an obligation into a sub-obligation.

FunctionsΒ§

anonymize_predicate
async_iterator_trait_ref_and_outputs πŸ”’
closure_trait_ref_and_return_type πŸ”’
coroutine_trait_ref_and_outputs πŸ”’
elaborate
elaborate_outlives_assumptions
expand_trait_aliases
Return the trait and projection predicates that come from eagerly expanding the trait aliases in the list of clauses. For each trait predicate, record a stack of spans that trace from the user-written trait alias bound. For projection predicates, just record the span of the projection itself.
future_trait_ref_and_outputs πŸ”’
impl_item_is_final
implicit_fast_path
iterator_trait_ref_and_outputs πŸ”’
lazily_elaborate_sizedness_candidate πŸ”’
To improve performance, sizedness traits are not elaborated and so special-casing is required in the trait solver to find a Sized candidate for a MetaSized obligation. Returns the predicate to used in the candidate for such a obligation, given a candidate.
supertrait_def_ids
Computes the def-ids of the transitive supertraits of trait_def_id. This (intentionally) does not compute the full elaborated super-predicates but just the set of def-ids. It is used to identify which traits may define a given associated type to help avoid cycle errors, and to make size estimates for vtable layout computation.
supertraits
transitive_bounds_that_define_assoc_item
A specialized variant of elaborate that only elaborates trait references that may define the given associated item with the name assoc_name. It uses the explicit_supertraits_containing_assoc_item query to avoid enumerating super-predicates that aren’t related to assoc_item. This is used when resolving types like Self::Item or T::Item and helps to avoid cycle errors (see e.g. #35237).
upcast_choices
Casts a trait reference into a reference to one of its super traits; returns None if target_trait_def_id is not a supertrait.
with_replaced_escaping_bound_vars
Executes f on value after replacing all escaping bound variables with placeholders and then replaces these placeholders with the original bound variables in the result.