Function chalk_solve::clauses::builtin_traits::fn_family::add_fn_trait_program_clauses
source ยท pub fn add_fn_trait_program_clauses<I: Interner>(
db: &dyn RustIrDatabase<I>,
builder: &mut ClauseBuilder<'_, I>,
well_known: WellKnownTrait,
self_ty: Ty<I>,
)Expand description
Handles clauses for FnOnce/FnMut/Fn.
If self_ty is a function, we push a clause of the form
fn(A1, A2, ..., AN) -> O: FnTrait<(A1, A2, ..., AN)>, where FnTrait
is the trait corresponding to trait_id (FnOnce/FnMut/Fn)
If trait_id is FnOnce, we also push a clause for the output type of the form:
Normalize(<fn(A) -> B as FnOnce<(A,)>>::Output -> B)
We do not add the usual Implemented(fn(A) -> b as FnOnce<(A,)> clause
as a condition, since we already called push_fact with it