FulfillmentContext, Obligation, ObligationCause, SelectionContext, TraitEngine, Vtable,
};
use crate::ty::fold::TypeFoldable;
-use crate::ty::subst::{Subst, SubstsRef};
use crate::ty::{self, TyCtxt};
/// Attempts to resolve an obligation to a vtable. The result is
})
}
-impl<'tcx> TyCtxt<'tcx> {
- /// Monomorphizes a type from the AST by first applying the
- /// in-scope substitutions and then normalizing any associated
- /// types.
- pub fn subst_and_normalize_erasing_regions<T>(
- self,
- param_substs: SubstsRef<'tcx>,
- param_env: ty::ParamEnv<'tcx>,
- value: &T,
- ) -> T
- where
- T: TypeFoldable<'tcx>,
- {
- debug!(
- "subst_and_normalize_erasing_regions(\
- param_substs={:?}, \
- value={:?}, \
- param_env={:?})",
- param_substs, value, param_env,
- );
- let substituted = value.subst(self, param_substs);
- self.normalize_erasing_regions(param_env, substituted)
- }
-}
-
// # Global Cache
impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
//! within. (This underlying query is what is cached.)
use crate::ty::fold::{TypeFoldable, TypeFolder};
+use crate::ty::subst::{Subst, SubstsRef};
use crate::ty::{self, Ty, TyCtxt};
impl<'tcx> TyCtxt<'tcx> {
let value = self.erase_late_bound_regions(value);
self.normalize_erasing_regions(param_env, value)
}
+
+ /// Monomorphizes a type from the AST by first applying the
+ /// in-scope substitutions and then normalizing any associated
+ /// types.
+ pub fn subst_and_normalize_erasing_regions<T>(
+ self,
+ param_substs: SubstsRef<'tcx>,
+ param_env: ty::ParamEnv<'tcx>,
+ value: &T,
+ ) -> T
+ where
+ T: TypeFoldable<'tcx>,
+ {
+ debug!(
+ "subst_and_normalize_erasing_regions(\
+ param_substs={:?}, \
+ value={:?}, \
+ param_env={:?})",
+ param_substs, value, param_env,
+ );
+ let substituted = value.subst(self, param_substs);
+ self.normalize_erasing_regions(param_env, substituted)
+ }
}
struct NormalizeAfterErasingRegionsFolder<'tcx> {