pub fn add_builtin_program_clauses<I: Interner>(
    db: &dyn RustIrDatabase<I>,
    builder: &mut ClauseBuilder<'_, I>,
    well_known: WellKnownTrait,
    trait_ref: &TraitRef<I>,
    binders: &CanonicalVarKinds<I>,
) -> Result<(), Floundered> {
    // If `trait_ref` contains bound vars, we want to universally quantify them.
    // `Generalize` collects them for us.
    let generalized = generalize::Generalize::apply(db.interner(), trait_ref);

    builder.push_binders(&generalized, |builder, trait_ref| {
        let self_ty = trait_ref.self_type_parameter(db.interner());
        let ty = self_ty.kind(db.interner());

        match well_known {
            WellKnownTrait::Sized => {
                sized::add_sized_program_clauses(db, builder, &trait_ref, ty, binders)
            }
            WellKnownTrait::Copy => {
                copy::add_copy_program_clauses(db, builder, &trait_ref, ty, binders)
            }
            WellKnownTrait::Clone => {
                clone::add_clone_program_clauses(db, builder, &trait_ref, ty, binders)
            }
            WellKnownTrait::FnOnce | WellKnownTrait::FnMut | WellKnownTrait::Fn => {
                fn_family::add_fn_trait_program_clauses(db, builder, well_known, self_ty)?
            }
            WellKnownTrait::Unsize => {
                unsize::add_unsize_program_clauses(db, builder, &trait_ref, ty)
            }
            // There are no builtin impls provided for the following traits:
            WellKnownTrait::Unpin | WellKnownTrait::Drop | WellKnownTrait::CoerceUnsized => (),
        }
        Ok(())
    })
}
/// For well known traits we have special hard-coded impls, either as an
/// optimization or to enforce special rules for correctness.
For well known traits we have special hard-coded impls, either as an
optimization or to enforce special rules for correctness.
For well known traits we have special hard - coded impls either as an optimization or to enforce special rules for correctness .
pub fn add_builtin_program_clauses<I: Interner>(
    db: &dyn RustIrDatabase<I>,
    builder: &mut ClauseBuilder<'_, I>,
    well_known: WellKnownTrait,
    trait_ref: &TraitRef<I>,
    binders: &CanonicalVarKinds<I>,
) -> Result<(), Floundered> {
    // If `trait_ref` contains bound vars, we want to universally quantify them.
    // `Generalize` collects them for us.
    let generalized = generalize::Generalize::apply(db.interner(), trait_ref);
    builder.push_binders(&generalized, |builder, trait_ref| {
        let self_ty = trait_ref.self_type_parameter(db.interner());
        let ty = self_ty.kind(db.interner());
        match well_known {
            WellKnownTrait::Sized => {
                sized::add_sized_program_clauses(db, builder, &trait_ref, ty, binders)
            }
            WellKnownTrait::Copy => {
                copy::add_copy_program_clauses(db, builder, &trait_ref, ty, binders)
            }
            WellKnownTrait::Clone => {
                clone::add_clone_program_clauses(db, builder, &trait_ref, ty, binders)
            }
            WellKnownTrait::FnOnce | WellKnownTrait::FnMut | WellKnownTrait::Fn => {
                fn_family::add_fn_trait_program_clauses(db, builder, well_known, self_ty)?
            }
            WellKnownTrait::Unsize => {
                unsize::add_unsize_program_clauses(db, builder, &trait_ref, ty)
            }
            // There are no builtin impls provided for the following traits:
            WellKnownTrait::Unpin | WellKnownTrait::Drop | WellKnownTrait::CoerceUnsized => (),
        }
        Ok(())
    })
}
pub fn add_builtin_program_clauses < I : Interner > ( db : & dyn RustIrDatabase < I > , builder : & mut ClauseBuilder < ' _ , I > , well_known : WellKnownTrait , trait_ref : & TraitRef < I > , binders : & CanonicalVarKinds < I > , ) -> Result < ( ) , Floundered > { // If `trait_ref` contains bound vars, we want to universally quantify them. // `Generalize` collects them for us. let generalized = generalize :: Generalize :: apply ( db . interner ( ) , trait_ref ) ; builder . push_binders ( & generalized , | builder , trait_ref | { let self_ty = trait_ref . self_type_parameter ( db . interner ( ) ) ; let ty = self_ty . kind ( db . interner ( ) ) ; match well_known { WellKnownTrait :: Sized => { sized :: add_sized_program_clauses ( db , builder , & trait_ref , ty , binders ) } WellKnownTrait :: Copy => { copy :: add_copy_program_clauses ( db , builder , & trait_ref , ty , binders ) } WellKnownTrait :: Clone => { clone :: add_clone_program_clauses ( db , builder , & trait_ref , ty , binders ) } WellKnownTrait :: FnOnce | WellKnownTrait :: FnMut | WellKnownTrait :: Fn => { fn_family :: add_fn_trait_program_clauses ( db , builder , well_known , self_ty ) ? } WellKnownTrait :: Unsize => { unsize :: add_unsize_program_clauses ( db , builder , & trait_ref , ty ) } // There are no builtin impls provided for the following traits: WellKnownTrait :: Unpin | WellKnownTrait :: Drop | WellKnownTrait :: CoerceUnsized => ( ) , } Ok ( ( ) ) } ) }
For well known traits we have special hard-coded impls, either as an
optimization or to enforce special rules for correctness.
For well known traits we have special hard - coded impls either as an optimization or to enforce special rules for correctness .
db
&dyn RustIrDatabase<I>
builder
&mut ClauseBuilder<'_, I>
well_known
WellKnownTrait
trait_ref
&TraitRef<I>
binders
&CanonicalVarKinds<I>