Skip to content

Commit e37a3a8

Browse files
committed
Explain how to evaluate an obligation
1 parent c88ba28 commit e37a3a8

File tree

1 file changed

+9
-3
lines changed
  • compiler/rustc_trait_selection/src

1 file changed

+9
-3
lines changed

compiler/rustc_trait_selection/src/infer.rs

+9-3
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,15 @@ impl<'tcx> InferCtxt<'tcx> {
6969
/// .must_apply_modulo_regions();
7070
/// ```
7171
///
72-
/// In most cases you should instead create an [Obligation](traits::Obligation)
73-
/// and check whether it holds, because it properly handles higher ranked traits
74-
/// and it is more convenient and safer when your `params` are inside a `Binder`.
72+
/// In most cases you should instead create an [Obligation] and check whether
73+
/// it holds via [`evaluate_obligation`] or one of its helper functions like
74+
/// [`predicate_must_hold_modulo_regions`], because it properly handles higher ranked traits
75+
/// and it is more convenient and safer when your `params` are inside a [`Binder`].
76+
///
77+
/// [Obligation]: traits::Obligation
78+
/// [`evaluate_obligation`]: crate::traits::query::evaluate_obligation::InferCtxtExt::evaluate_obligation
79+
/// [`predicate_must_hold_modulo_regions`]: crate::traits::query::evaluate_obligation::InferCtxtExt::predicate_must_hold_modulo_regions
80+
/// [`Binder`]: ty::Binder
7581
#[instrument(level = "debug", skip(self, params), ret)]
7682
fn type_implements_trait(
7783
&self,

0 commit comments

Comments
 (0)