Skip to content

Commit

Permalink
extend docs for predicate_must_hold_considering_regions
Browse files Browse the repository at this point in the history
  • Loading branch information
Lukas Markeffsky committed Feb 5, 2024
1 parent 8c0b4f6 commit 77fb540
Showing 1 changed file with 22 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,28 @@ impl<'tcx> InferCtxtExt<'tcx> for InferCtxt<'tcx> {
/// not entirely accurate if inference variables are involved.
///
/// This version may conservatively fail when outlives obligations
/// are required.
/// are required. Therefore, this version should only be used for
/// optimizations or diagnostics and be treated as if it can always
/// return `false`.
///
/// # Example
///
/// ```
/// # #![allow(dead_code)]
/// trait Trait {}
///
/// fn check<T: Trait>() {}
///
/// fn foo<T: 'static>()
/// where
/// &'static T: Trait,
/// {
/// // Evaluating `&'?0 T: Trait` adds a `'?0: 'static` outlives obligation,
/// // which means that `predicate_must_hold_considering_regions` will return
/// // `false`.
/// check::<&'_ T>();
/// }
/// ```
fn predicate_must_hold_considering_regions(
&self,
obligation: &PredicateObligation<'tcx>,
Expand Down

0 comments on commit 77fb540

Please sign in to comment.