Account for new ast::GenericParamKind::Const::default in rust_ast.

This commit is contained in:
Mara Bos 2021-01-01 20:47:30 +01:00 committed by Caleb Cartwright
parent a6b0c18dc9
commit 5bb17a0d36
2 changed files with 14 additions and 2 deletions

View file

@ -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()

View file

@ -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(": ");