Add query for const_param_default

This commit is contained in:
kadmin 2021-03-03 06:38:02 +00:00
parent 0e56a086f7
commit 9fe793ae5d
17 changed files with 108 additions and 27 deletions

View file

@ -93,6 +93,12 @@ rustc_queries! {
desc { |tcx| "computing the optional const parameter of `{}`", tcx.def_path_str(key.to_def_id()) }
}
/// Given the def_id of a const-generic parameter, computes the associated default const
/// parameter. i.e. `fn example<const N: usize=3>` called on N would return 3.
query const_param_default(param: DefId) -> &'tcx ty::Const<'tcx> {
desc { |tcx| "compute const default for a given parameter `{}`", tcx.def_path_str(param) }
}
/// Records the type of every item.
query type_of(key: DefId) -> Ty<'tcx> {
desc { |tcx| "computing type of `{}`", tcx.def_path_str(key) }