Document how to get the type of a default associated type
This commit is contained in:
parent
159ba8a92c
commit
b7cb77fed9
1 changed files with 5 additions and 0 deletions
|
@ -37,6 +37,11 @@ impl AssocItem {
|
||||||
Ident::new(self.name, tcx.def_ident_span(self.def_id).unwrap())
|
Ident::new(self.name, tcx.def_ident_span(self.def_id).unwrap())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Gets the defaultness of the associated item.
|
||||||
|
/// To get the default associated type, use the [`type_of`] query on the
|
||||||
|
/// [`DefId`] of the type.
|
||||||
|
///
|
||||||
|
/// [`type_of`]: crate::ty::TyCtxt::type_of
|
||||||
pub fn defaultness(&self, tcx: TyCtxt<'_>) -> hir::Defaultness {
|
pub fn defaultness(&self, tcx: TyCtxt<'_>) -> hir::Defaultness {
|
||||||
tcx.impl_defaultness(self.def_id)
|
tcx.impl_defaultness(self.def_id)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue