Skip to content

Commit b7cb77f

Browse files
committed
Document how to get the type of a default associated type
1 parent 159ba8a commit b7cb77f

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

compiler/rustc_middle/src/ty/assoc.rs

+5
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,11 @@ impl AssocItem {
3737
Ident::new(self.name, tcx.def_ident_span(self.def_id).unwrap())
3838
}
3939

40+
/// Gets the defaultness of the associated item.
41+
/// To get the default associated type, use the [`type_of`] query on the
42+
/// [`DefId`] of the type.
43+
///
44+
/// [`type_of`]: crate::ty::TyCtxt::type_of
4045
pub fn defaultness(&self, tcx: TyCtxt<'_>) -> hir::Defaultness {
4146
tcx.impl_defaultness(self.def_id)
4247
}

0 commit comments

Comments
 (0)