Update docs of hir::TypeBinding

This commit is contained in:
León Orell Valerian Liehr 2024-03-06 23:45:36 +01:00
parent 6b85f075cc
commit d3d77a8733
No known key found for this signature in database
GPG key ID: D17A07215F68E713

View file

@ -2289,21 +2289,15 @@ pub enum ImplItemKind<'hir> {
Type(&'hir Ty<'hir>), Type(&'hir Ty<'hir>),
} }
/// Bind a type to an associated type (i.e., `A = Foo`). /// An associated item binding.
/// ///
/// Bindings like `A: Debug` are represented as a special type `A = /// ### Examples
/// $::Debug` that is understood by the HIR ty lowering code.
/// ///
/// FIXME(alexreg): why have a separate type for the binding case, /// * `Trait<A = Ty, B = Ty>`
/// wouldn't it be better to make the `ty` field an enum like the /// * `Trait<G<Ty> = Ty>`
/// following? /// * `Trait<A: Bound>`
/// /// * `Trait<C = { Ct }>` (under feature `associated_const_equality`)
/// ```ignore (pseudo-rust) /// * `Trait<f(): Bound>` (under feature `return_type_notation`)
/// enum TypeBindingKind {
/// Equals(...),
/// Binding(...),
/// }
/// ```
#[derive(Debug, Clone, Copy, HashStable_Generic)] #[derive(Debug, Clone, Copy, HashStable_Generic)]
pub struct TypeBinding<'hir> { pub struct TypeBinding<'hir> {
pub hir_id: HirId, pub hir_id: HirId,
@ -2336,7 +2330,7 @@ impl<'hir> From<AnonConst> for Term<'hir> {
pub enum TypeBindingKind<'hir> { pub enum TypeBindingKind<'hir> {
/// E.g., `Foo<Bar: Send>`. /// E.g., `Foo<Bar: Send>`.
Constraint { bounds: &'hir [GenericBound<'hir>] }, Constraint { bounds: &'hir [GenericBound<'hir>] },
/// E.g., `Foo<Bar = ()>`, `Foo<Bar = ()>` /// E.g., `Foo<Bar = ()>`.
Equality { term: Term<'hir> }, Equality { term: Term<'hir> },
} }