diff options
Diffstat (limited to 'compiler/rustc_ast/src')
| -rw-r--r-- | compiler/rustc_ast/src/ast.rs | 9 | ||||
| -rw-r--r-- | compiler/rustc_ast/src/visit.rs | 3 | 
2 files changed, 5 insertions, 7 deletions
| diff --git a/compiler/rustc_ast/src/ast.rs b/compiler/rustc_ast/src/ast.rs index 3aceec7002a..61b22ccc3bf 100644 --- a/compiler/rustc_ast/src/ast.rs +++ b/compiler/rustc_ast/src/ast.rs @@ -385,8 +385,8 @@ pub enum GenericParamKind { }, Const { ty: P<Ty>, - /// Span of the `const` keyword. - kw_span: Span, + /// Span of the whole parameter definition, including default. + span: Span, /// Optional default value for the const generic param. default: Option<AnonConst>, }, @@ -410,10 +410,7 @@ impl GenericParam { self.ident.span } GenericParamKind::Type { default: Some(ty) } => self.ident.span.to(ty.span), - GenericParamKind::Const { kw_span, default: Some(default), .. } => { - kw_span.to(default.value.span) - } - GenericParamKind::Const { kw_span, default: None, ty } => kw_span.to(ty.span), + GenericParamKind::Const { span, .. } => *span, } } } diff --git a/compiler/rustc_ast/src/visit.rs b/compiler/rustc_ast/src/visit.rs index 867ab7d9478..ad6fa4ac216 100644 --- a/compiler/rustc_ast/src/visit.rs +++ b/compiler/rustc_ast/src/visit.rs @@ -1350,9 +1350,10 @@ macro_rules! common_visitor_and_walkers { match kind { GenericParamKind::Lifetime => (), GenericParamKind::Type { default } => visit_opt!(vis, visit_ty, default), - GenericParamKind::Const { ty, default, kw_span: _ } => { + GenericParamKind::Const { ty, default, span } => { try_visit!(vis.visit_ty(ty)); visit_opt!(vis, visit_anon_const, default); + try_visit!(visit_span(vis, span)); } } if let Some(sp) = colon_span { | 
