Rollup merge of #138482 - nnethercote:fix-hir-printing, r=compiler-errors

Fix HIR printing of parameters

HIR pretty printing does the wrong thing for anonymous parameters, and there is no test coverage for it. This PR remedies both of those things.

r? ``@lcnr``
This commit is contained in:
León Orell Valerian Liehr
2025-03-15 00:18:25 +01:00
committed by GitHub
8 changed files with 115 additions and 24 deletions

View File

@@ -281,8 +281,9 @@ impl<'tcx> TyCtxt<'tcx> {
}
pub fn hir_body_param_names(self, id: BodyId) -> impl Iterator<Item = Ident> {
self.hir_body(id).params.iter().map(|arg| match arg.pat.kind {
self.hir_body(id).params.iter().map(|param| match param.pat.kind {
PatKind::Binding(_, _, ident, _) => ident,
PatKind::Wild => Ident::new(kw::Underscore, param.pat.span),
_ => Ident::empty(),
})
}