1
Fork 0

Update with comments

This commit is contained in:
kadmin 2021-03-20 22:34:58 +00:00
parent ea2af70466
commit 7116bb5c33
9 changed files with 74 additions and 35 deletions

View file

@ -94,7 +94,7 @@ rustc_queries! {
}
/// 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.
/// parameter. e.g. `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) }
}

View file

@ -212,7 +212,7 @@ pub fn const_param_default<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> &'tcx Cons
}) => tcx.hir().local_def_id(ac.hir_id),
_ => span_bug!(
tcx.def_span(def_id),
"const_param_defaults expected a generic parameter with a constant"
"`const_param_default` expected a generic parameter with a constant"
),
};
Const::from_anon_const(tcx, default_def_id)