More docs

This commit is contained in:
Michael Goulet
2022-08-17 16:20:22 +00:00
parent 8917894fda
commit 2a16a127a0
3 changed files with 18 additions and 5 deletions

View File

@@ -122,6 +122,10 @@ pub struct Generics {
}
impl<'tcx> Generics {
/// Looks through the generics and all parents to find the index of the
/// given param def-id. This is in comparison to the `param_def_id_to_index`
/// struct member, which only stores information about this item's own
/// generics.
pub fn param_def_id_to_index(&self, tcx: TyCtxt<'tcx>, def_id: DefId) -> Option<u32> {
if let Some(idx) = self.param_def_id_to_index.get(&def_id) {
Some(*idx)