]> git.lizzy.rs Git - rust.git/commitdiff
ty: add doc comments to `Generics` methods
authorDavid Wood <david@davidtw.co>
Mon, 22 Jun 2020 12:24:59 +0000 (13:24 +0100)
committerDavid Wood <david@davidtw.co>
Mon, 20 Jul 2020 10:23:27 +0000 (11:23 +0100)
This commit adds doc comments to the `param_at`, `region_param` and
`const_param` methods on the `Generics` struct.

Signed-off-by: David Wood <david@davidtw.co>
src/librustc_middle/ty/mod.rs

index 21745977b04b1b805b9f84db86653b68ae05c486..51a353c0132412cb0cdf5429bf4d0fdb7c71f144 100644 (file)
@@ -890,6 +890,7 @@ pub fn own_requires_monomorphization(&self) -> bool {
         false
     }
 
+    /// Returns the `GenericParamDef` with the given index.
     pub fn param_at(&'tcx self, param_index: usize, tcx: TyCtxt<'tcx>) -> &'tcx GenericParamDef {
         if let Some(index) = param_index.checked_sub(self.parent_count) {
             &self.params[index]
@@ -899,6 +900,7 @@ pub fn param_at(&'tcx self, param_index: usize, tcx: TyCtxt<'tcx>) -> &'tcx Gene
         }
     }
 
+    /// Returns the `GenericParamDef` associated with this `EarlyBoundRegion`.
     pub fn region_param(
         &'tcx self,
         param: &EarlyBoundRegion,
@@ -920,7 +922,7 @@ pub fn type_param(&'tcx self, param: &ParamTy, tcx: TyCtxt<'tcx>) -> &'tcx Gener
         }
     }
 
-    /// Returns the `ConstParameterDef` associated with this `ParamConst`.
+    /// Returns the `GenericParamDef` associated with this `ParamConst`.
     pub fn const_param(&'tcx self, param: &ParamConst, tcx: TyCtxt<'tcx>) -> &GenericParamDef {
         let param = self.param_at(param.index as usize, tcx);
         match param.kind {