summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Wood <david@davidtw.co>2020-06-22 13:24:59 +0100
committerDavid Wood <david@davidtw.co>2020-07-20 11:23:27 +0100
commit842fa0ce3e93918fb574dfebc26abdfbed6138ec (patch)
tree8df99a4a27313daa57958f27518c7c14604d9048
parentce7c48fa156a4641d2f89a20e9e14cc050b40388 (diff)
downloadrust-842fa0ce3e93918fb574dfebc26abdfbed6138ec.tar.gz
ty: add doc comments to `Generics` methods
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>
-rw-r--r--src/librustc_middle/ty/mod.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/librustc_middle/ty/mod.rs b/src/librustc_middle/ty/mod.rs
index 21745977b04..51a353c0132 100644
--- a/src/librustc_middle/ty/mod.rs
+++ b/src/librustc_middle/ty/mod.rs
@@ -890,6 +890,7 @@ impl<'tcx> Generics {
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 @@ impl<'tcx> Generics {
}
}
+ /// Returns the `GenericParamDef` associated with this `EarlyBoundRegion`.
pub fn region_param(
&'tcx self,
param: &EarlyBoundRegion,
@@ -920,7 +922,7 @@ impl<'tcx> Generics {
}
}
- /// 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 {