Remove another use of clone_code
This commit is contained in:
parent
063795ce4a
commit
dc21fcb2fc
@ -183,7 +183,7 @@ impl<'tcx> ObligationCause<'tcx> {
|
|||||||
pub fn derived_cause(
|
pub fn derived_cause(
|
||||||
mut self,
|
mut self,
|
||||||
parent_trait_pred: ty::PolyTraitPredicate<'tcx>,
|
parent_trait_pred: ty::PolyTraitPredicate<'tcx>,
|
||||||
variant: fn(DerivedObligationCause<'tcx>) -> ObligationCauseCode<'tcx>,
|
variant: impl FnOnce(DerivedObligationCause<'tcx>) -> ObligationCauseCode<'tcx>,
|
||||||
) -> ObligationCause<'tcx> {
|
) -> ObligationCause<'tcx> {
|
||||||
/*!
|
/*!
|
||||||
* Creates a cause for obligations that are derived from
|
* Creates a cause for obligations that are derived from
|
||||||
|
@ -14,9 +14,9 @@ use super::util;
|
|||||||
use super::util::{closure_trait_ref_and_return_type, predicate_for_trait_def};
|
use super::util::{closure_trait_ref_and_return_type, predicate_for_trait_def};
|
||||||
use super::wf;
|
use super::wf;
|
||||||
use super::{
|
use super::{
|
||||||
DerivedObligationCause, ErrorReporting, ImplDerivedObligation, ImplDerivedObligationCause,
|
ErrorReporting, ImplDerivedObligation, ImplDerivedObligationCause, Normalized, Obligation,
|
||||||
Normalized, Obligation, ObligationCause, ObligationCauseCode, Overflow, PredicateObligation,
|
ObligationCause, ObligationCauseCode, Overflow, PredicateObligation, Selection, SelectionError,
|
||||||
Selection, SelectionError, SelectionResult, TraitObligation, TraitQueryMode,
|
SelectionResult, TraitObligation, TraitQueryMode,
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::infer::{InferCtxt, InferOk, TypeFreshener};
|
use crate::infer::{InferCtxt, InferOk, TypeFreshener};
|
||||||
@ -2316,17 +2316,15 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||||||
debug!(?predicates);
|
debug!(?predicates);
|
||||||
assert_eq!(predicates.parent, None);
|
assert_eq!(predicates.parent, None);
|
||||||
let mut obligations = Vec::with_capacity(predicates.predicates.len());
|
let mut obligations = Vec::with_capacity(predicates.predicates.len());
|
||||||
let parent_code = cause.clone_code();
|
|
||||||
for (predicate, span) in predicates.predicates {
|
for (predicate, span) in predicates.predicates {
|
||||||
let span = *span;
|
let span = *span;
|
||||||
let derived =
|
let cause = cause.clone().derived_cause(parent_trait_pred, |derived| {
|
||||||
DerivedObligationCause { parent_trait_pred, parent_code: parent_code.clone() };
|
ImplDerivedObligation(Box::new(ImplDerivedObligationCause {
|
||||||
let code = ImplDerivedObligation(Box::new(ImplDerivedObligationCause {
|
derived,
|
||||||
derived,
|
impl_def_id: def_id,
|
||||||
impl_def_id: def_id,
|
span,
|
||||||
span,
|
}))
|
||||||
}));
|
});
|
||||||
let cause = ObligationCause::new(cause.span, cause.body_id, code);
|
|
||||||
let predicate = normalize_with_depth_to(
|
let predicate = normalize_with_depth_to(
|
||||||
self,
|
self,
|
||||||
param_env,
|
param_env,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user