File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed
compiler/rustc_trait_selection/src/traits/query Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -44,6 +44,25 @@ impl<'tcx> InferCtxtExt<'tcx> for InferCtxt<'tcx> {
4444 /// are required. Therefore, this version should only be used for
4545 /// optimizations or diagnostics and be treated as if it can always
4646 /// 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+ /// ```
4766 fn predicate_must_hold_considering_regions (
4867 & self ,
4968 obligation : & PredicateObligation < ' tcx > ,
You can’t perform that action at this time.
0 commit comments