Skip to main content

Module item_bounds

Module item_bounds 

Source

Re-exportsΒ§

use rustc_data_structures::fx::FxIndexMap; πŸ”’
use rustc_data_structures::fx::FxIndexSet; πŸ”’
use rustc_hir as hir; πŸ”’
use rustc_infer::traits::util; πŸ”’
use rustc_middle::ty; πŸ”’
use rustc_middle::ty::GenericArgs; πŸ”’
use rustc_middle::ty::PredicateProxy; πŸ”’
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::TypeVisitableExt; πŸ”’
use rustc_middle::ty::Upcast; πŸ”’
use rustc_middle::ty::shift_vars; πŸ”’
use rustc_span::def_id::DefId; πŸ”’
use rustc_span::def_id::LocalDefId; πŸ”’
use rustc_span::Span; πŸ”’
use rustc_span::bug; πŸ”’
use rustc_span::span_bug; πŸ”’
use tracing::debug; πŸ”’
use tracing::instrument; πŸ”’
use tracing::instrument; πŸ”’
use super::ItemCtxt; πŸ”’
use super::clauses_of::assert_only_contains_clauses_from; πŸ”’
use crate::hir_ty_lowering::HirTyLowerer; πŸ”’
use crate::hir_ty_lowering::ImpliedBoundsContext; πŸ”’
use crate::hir_ty_lowering::OverlappingAsssocItemConstraints; πŸ”’
use crate::hir_ty_lowering::PredicateFilter; πŸ”’

StructsΒ§

AssocTyToOpaque πŸ”’
MapAndCompressBoundVars πŸ”’
Given some where clause like for<'b, 'c> <Self as Trait<'a_identity>>::Gat<'b>: Bound<'c>, the mapping will map 'b back to the GAT’s 'b_identity. Then we need to compress the remaining bound var 'c to index 0.

FunctionsΒ§

associated_type_bounds πŸ”’
For associated types we include both bounds written on the type (type X: Trait) and predicates from the trait: where Self::X: Trait.
explicit_item_bounds πŸ”’
explicit_item_bounds_with_filter πŸ”’
explicit_item_self_bounds πŸ”’
impl_super_outlives πŸ”’
This exists as an optimization to compute only the supertraits of this impl’s trait that are outlives bounds.
item_bounds πŸ”’
item_non_self_bounds πŸ”’
This exists as an optimization to compute only the item bounds of the item that are not Self bounds.
item_self_bounds πŸ”’
opaque_type_bounds πŸ”’
Opaque types don’t inherit bounds from their parent: for return position impl trait it isn’t possible to write a suitable predicate on the containing function and for type-alias impl trait we don’t have a backwards compatibility issue.
remap_gat_vars_and_recurse_into_nested_projections πŸ”’
The code below is quite involved, so let me explain.