pub(crate) fn trait_solve_query(
    db: &impl HirDatabase,
    krate: CrateId,
    goal: Canonical<InEnvironment<Obligation>>,
) -> Option<Solution> {
    let _p = profile("trait_solve_query");
    log::debug!("trait_solve_query({})", goal.value.value.display(db));

    if let Obligation::Projection(pred) = &goal.value.value {
        if let Ty::Bound(_) = &pred.projection_ty.parameters[0] {
            // Hack: don't ask Chalk to normalize with an unknown self type, it'll say that's impossible
            return Some(Solution::Ambig(Guidance::Unknown));
        }
    }

    let canonical = goal.to_chalk(db).cast();

    // We currently don't deal with universes (I think / hope they're not yet
    // relevant for our use cases?)
    let u_canonical = chalk_ir::UCanonical { canonical, universes: 1 };
    let solution = db.trait_solver(krate).solve(db, &u_canonical);
    solution.map(|solution| solution_from_chalk(db, solution))
}
/// Solve a trait goal using Chalk.
Solve a trait goal using Chalk.
Solve a trait goal using Chalk .
pub(crate) fn trait_solve_query(
    db: &impl HirDatabase,
    krate: CrateId,
    goal: Canonical<InEnvironment<Obligation>>,
) -> Option<Solution> {
    let _p = profile("trait_solve_query");
    log::debug!("trait_solve_query({})", goal.value.value.display(db));
    if let Obligation::Projection(pred) = &goal.value.value {
        if let Ty::Bound(_) = &pred.projection_ty.parameters[0] {
            // Hack: don't ask Chalk to normalize with an unknown self type, it'll say that's impossible
            return Some(Solution::Ambig(Guidance::Unknown));
        }
    }
    let canonical = goal.to_chalk(db).cast();
    // We currently don't deal with universes (I think / hope they're not yet
    // relevant for our use cases?)
    let u_canonical = chalk_ir::UCanonical { canonical, universes: 1 };
    let solution = db.trait_solver(krate).solve(db, &u_canonical);
    solution.map(|solution| solution_from_chalk(db, solution))
}
pub ( crate ) fn trait_solve_query ( db : & impl HirDatabase , krate : CrateId , goal : Canonical < InEnvironment < Obligation > > , ) -> Option < Solution > { let _p = profile ( " " ) ; log :: debug ! ( " " goal value value display ( db ) ) ; if let Obligation :: Projection ( pred ) = & goal . value . value { if let Ty :: Bound ( _ ) = & pred . projection_ty . parameters [ 0 ] { // Hack: don't ask Chalk to normalize with an unknown self type, it'll say that's impossible return Some ( Solution :: Ambig ( Guidance :: Unknown ) ) ; } } let canonical = goal . to_chalk ( db ) . cast ( ) ; // We currently don't deal with universes (I think / hope they're not yet // relevant for our use cases?) let u_canonical = chalk_ir :: UCanonical { canonical , universes : 1 } ; let solution = db . trait_solver ( krate ) . solve ( db , & u_canonical ) ; solution . map ( | solution | solution_from_chalk ( db , solution ) ) }
Solve a trait goal using Chalk.
Solve a trait goal using Chalk .
db
&impl HirDatabase
krate
CrateId
goal
Canonical<InEnvironment<Obligation>>