Make ObligationCtxt::normalize take cause by borrow
This commit is contained in:
parent
ce409b5200
commit
1e236acd05
11 changed files with 27 additions and 29 deletions
|
@ -104,8 +104,7 @@ impl<'a, 'tcx> ObligationCtxt<'a, 'tcx> {
|
|||
|
||||
pub fn normalize<T: TypeFoldable<'tcx>>(
|
||||
&self,
|
||||
// FIXME(compiler-errors): Make this borrow
|
||||
cause: ObligationCause<'tcx>,
|
||||
cause: &ObligationCause<'tcx>,
|
||||
param_env: ty::ParamEnv<'tcx>,
|
||||
value: T,
|
||||
) -> T {
|
||||
|
@ -186,7 +185,7 @@ impl<'a, 'tcx> ObligationCtxt<'a, 'tcx> {
|
|||
// sound and then uncomment this line again.
|
||||
|
||||
// implied_bounds.insert(ty);
|
||||
let normalized = self.normalize(cause.clone(), param_env, ty);
|
||||
let normalized = self.normalize(&cause, param_env, ty);
|
||||
implied_bounds.insert(normalized);
|
||||
}
|
||||
implied_bounds
|
||||
|
|
|
@ -17,11 +17,11 @@ pub fn recompute_applicable_impls<'tcx>(
|
|||
let placeholder_obligation =
|
||||
infcx.replace_bound_vars_with_placeholders(obligation.predicate);
|
||||
let obligation_trait_ref =
|
||||
ocx.normalize(dummy_cause.clone(), param_env, placeholder_obligation.trait_ref);
|
||||
ocx.normalize(&dummy_cause, param_env, placeholder_obligation.trait_ref);
|
||||
|
||||
let impl_substs = infcx.fresh_substs_for_item(DUMMY_SP, impl_def_id);
|
||||
let impl_trait_ref = tcx.bound_impl_trait_ref(impl_def_id).unwrap().subst(tcx, impl_substs);
|
||||
let impl_trait_ref = ocx.normalize(ObligationCause::dummy(), param_env, impl_trait_ref);
|
||||
let impl_trait_ref = ocx.normalize(&ObligationCause::dummy(), param_env, impl_trait_ref);
|
||||
|
||||
if let Err(_) = ocx.eq(&dummy_cause, param_env, obligation_trait_ref, impl_trait_ref) {
|
||||
return false;
|
||||
|
|
|
@ -56,8 +56,8 @@ pub use self::object_safety::astconv_object_safety_violations;
|
|||
pub use self::object_safety::is_vtable_safe_method;
|
||||
pub use self::object_safety::MethodViolationCode;
|
||||
pub use self::object_safety::ObjectSafetyViolation;
|
||||
pub use self::project::{NormalizeExt, normalize_projection_type};
|
||||
pub(crate) use self::project::{normalize, normalize_to};
|
||||
pub use self::project::{normalize_projection_type, NormalizeExt};
|
||||
pub use self::select::{EvaluationCache, SelectionCache, SelectionContext};
|
||||
pub use self::select::{EvaluationResult, IntercrateAmbiguityCause, OverflowError};
|
||||
pub use self::specialize::specialization_graph::FutureCompatOverlapError;
|
||||
|
@ -387,7 +387,7 @@ where
|
|||
{
|
||||
let ocx = ObligationCtxt::new(infcx);
|
||||
debug!(?value);
|
||||
let normalized_value = ocx.normalize(cause, param_env, value);
|
||||
let normalized_value = ocx.normalize(&cause, param_env, value);
|
||||
debug!(?normalized_value);
|
||||
debug!("select_all_or_error start");
|
||||
let errors = ocx.select_all_or_error();
|
||||
|
@ -454,7 +454,7 @@ pub fn impossible_predicates<'tcx>(
|
|||
let infcx = tcx.infer_ctxt().build();
|
||||
let param_env = ty::ParamEnv::reveal_all();
|
||||
let ocx = ObligationCtxt::new(&infcx);
|
||||
let predicates = ocx.normalize(ObligationCause::dummy(), param_env, predicates);
|
||||
let predicates = ocx.normalize(&ObligationCause::dummy(), param_env, predicates);
|
||||
for predicate in predicates {
|
||||
let obligation = Obligation::new(tcx, ObligationCause::dummy(), param_env, predicate);
|
||||
ocx.register_obligation(obligation);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue