diff --git a/src/spanned.rs b/src/spanned.rs index 7bf370c131ed..9e3658dd22f0 100644 --- a/src/spanned.rs +++ b/src/spanned.rs @@ -113,7 +113,14 @@ impl Spanned for ast::Param { impl Spanned for ast::GenericParam { fn span(&self) -> Span { - let lo = if self.attrs.is_empty() { + let lo = if let ast::GenericParamKind::Const { + ty: _, + kw_span, + default: _, + } = self.kind + { + kw_span.lo() + } else if self.attrs.is_empty() { self.ident.span.lo() } else { self.attrs[0].span.lo() diff --git a/src/types.rs b/src/types.rs index 6e1fc8fc387f..bedc29fbc1ad 100644 --- a/src/types.rs +++ b/src/types.rs @@ -563,7 +563,12 @@ impl Rewrite for ast::GenericParam { _ => (), } - if let rustc_ast::ast::GenericParamKind::Const { ref ty, .. } = &self.kind { + if let ast::GenericParamKind::Const { + ref ty, + kw_span: _, + default: _, + } = &self.kind + { result.push_str("const "); result.push_str(rewrite_ident(context, self.ident)); result.push_str(": ");