File tree 1 file changed +22
-1
lines changed
compiler/rustc_trait_selection/src/traits/query
1 file changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -41,7 +41,28 @@ impl<'tcx> InferCtxtExt<'tcx> for InferCtxt<'tcx> {
41
41
/// not entirely accurate if inference variables are involved.
42
42
///
43
43
/// This version may conservatively fail when outlives obligations
44
- /// are required.
44
+ /// are required. Therefore, this version should only be used for
45
+ /// optimizations or diagnostics and be treated as if it can always
46
+ /// return `false`.
47
+ ///
48
+ /// # Example
49
+ ///
50
+ /// ```
51
+ /// # #![allow(dead_code)]
52
+ /// trait Trait {}
53
+ ///
54
+ /// fn check<T: Trait>() {}
55
+ ///
56
+ /// fn foo<T: 'static>()
57
+ /// where
58
+ /// &'static T: Trait,
59
+ /// {
60
+ /// // Evaluating `&'?0 T: Trait` adds a `'?0: 'static` outlives obligation,
61
+ /// // which means that `predicate_must_hold_considering_regions` will return
62
+ /// // `false`.
63
+ /// check::<&'_ T>();
64
+ /// }
65
+ /// ```
45
66
fn predicate_must_hold_considering_regions (
46
67
& self ,
47
68
obligation : & PredicateObligation < ' tcx > ,
You can’t perform that action at this time.
0 commit comments