From 5bb17a0d368a6fc73adc2cec393d381da60577f6 Mon Sep 17 00:00:00 2001 From: Mara Bos Date: Fri, 1 Jan 2021 20:47:30 +0100 Subject: [PATCH] Account for new ast::GenericParamKind::Const::default in rust_ast. --- src/spanned.rs | 9 ++++++++- src/types.rs | 7 ++++++- 2 files changed, 14 insertions(+), 2 deletions(-) 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(": ");