Add built-in const impls for Clone and Copy
This commit is contained in:
parent
2888098522
commit
744c670812
5 changed files with 133 additions and 8 deletions
|
|
@ -211,10 +211,32 @@ where
|
|||
}
|
||||
|
||||
fn consider_builtin_copy_clone_candidate(
|
||||
_ecx: &mut EvalCtxt<'_, D>,
|
||||
_goal: Goal<I, Self>,
|
||||
ecx: &mut EvalCtxt<'_, D>,
|
||||
goal: Goal<I, Self>,
|
||||
) -> Result<Candidate<I>, NoSolution> {
|
||||
Err(NoSolution)
|
||||
let cx = ecx.cx();
|
||||
|
||||
let self_ty = goal.predicate.self_ty();
|
||||
let constituent_tys =
|
||||
structural_traits::instantiate_constituent_tys_for_copy_clone_trait(ecx, self_ty)?;
|
||||
|
||||
ecx.probe_builtin_trait_candidate(BuiltinImplSource::Misc).enter(|ecx| {
|
||||
ecx.enter_forall(constituent_tys, |ecx, tys| {
|
||||
ecx.add_goals(
|
||||
GoalSource::ImplWhereBound,
|
||||
tys.into_iter().map(|ty| {
|
||||
goal.with(
|
||||
cx,
|
||||
ty::ClauseKind::HostEffect(
|
||||
goal.predicate.with_replaced_self_ty(cx, ty),
|
||||
),
|
||||
)
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
ecx.evaluate_added_goals_and_make_canonical_response(Certainty::Yes)
|
||||
})
|
||||
}
|
||||
|
||||
fn consider_builtin_fn_ptr_trait_candidate(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue