Explain how to evaluate an obligation

This commit is contained in:
mejrs 2024-11-05 01:08:20 +01:00
parent c88ba28d9a
commit e37a3a85e4

View File

@ -69,9 +69,15 @@ impl<'tcx> InferCtxt<'tcx> {
/// .must_apply_modulo_regions();
/// ```
///
/// In most cases you should instead create an [Obligation](traits::Obligation)
/// and check whether it holds, because it properly handles higher ranked traits
/// and it is more convenient and safer when your `params` are inside a `Binder`.
/// In most cases you should instead create an [Obligation] and check whether
/// it holds via [`evaluate_obligation`] or one of its helper functions like
/// [`predicate_must_hold_modulo_regions`], because it properly handles higher ranked traits
/// and it is more convenient and safer when your `params` are inside a [`Binder`].
///
/// [Obligation]: traits::Obligation
/// [`evaluate_obligation`]: crate::traits::query::evaluate_obligation::InferCtxtExt::evaluate_obligation
/// [`predicate_must_hold_modulo_regions`]: crate::traits::query::evaluate_obligation::InferCtxtExt::predicate_must_hold_modulo_regions
/// [`Binder`]: ty::Binder
#[instrument(level = "debug", skip(self, params), ret)]
fn type_implements_trait(
&self,