Skip to content

Commit 98cd031

Browse files
WaffleLapkinlowr
andcommitted
Add a doc comment for super_traits
Co-authored-by: Ryo Yoshida <[email protected]>
1 parent 68e7b98 commit 98cd031

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

chalk-solve/src/clauses/super_traits.rs

+21
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,27 @@ pub(super) fn push_trait_super_clauses<I: Interner>(
7373
}
7474
}
7575

76+
/// Returns super-`TraitRef`s and super-`Projection`s that are quantified over the parameters of
77+
/// `trait_id` and relevant higher-ranked lifetimes. The outer `Binders` is for the former and the
78+
/// inner `Binders` is for the latter.
79+
///
80+
/// For example, given the following trait definitions and `C` as `trait_id`,
81+
///
82+
/// ```
83+
/// trait A<'a, T> {}
84+
/// trait B<'b, U> where Self: for<'x> A<'x, U> {}
85+
/// trait C<'c, V> where Self: B<'c, V> {}
86+
/// ```
87+
///
88+
/// returns the following quantified `TraitRef`s.
89+
///
90+
/// ```notrust
91+
/// for<Self, 'c, V> {
92+
/// for<'x> { Self: A<'x, V> }
93+
/// for<> { Self: B<'c, V> }
94+
/// for<> { Self: C<'c, V> }
95+
/// }
96+
/// ```
7697
pub(crate) fn super_traits<I: Interner>(
7798
db: &dyn RustIrDatabase<I>,
7899
trait_id: TraitId<I>,

0 commit comments

Comments
 (0)