extend docs for predicate_must_hold_considering_regions
This commit is contained in:
parent
8c0b4f67c9
commit
77fb540684
1 changed files with 22 additions and 1 deletions
|
@ -41,7 +41,28 @@ impl<'tcx> InferCtxtExt<'tcx> for InferCtxt<'tcx> {
|
||||||
/// not entirely accurate if inference variables are involved.
|
/// not entirely accurate if inference variables are involved.
|
||||||
///
|
///
|
||||||
/// This version may conservatively fail when outlives obligations
|
/// 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(
|
fn predicate_must_hold_considering_regions(
|
||||||
&self,
|
&self,
|
||||||
obligation: &PredicateObligation<'tcx>,
|
obligation: &PredicateObligation<'tcx>,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue