about summary refs log tree commit diff
path: root/compiler/rustc_ast/src/ast.rs
diff options
context:
space:
mode:
authorCamille GILLOT <gillot.camille@gmail.com>2024-07-02 09:38:49 +0000
committerCamille GILLOT <gillot.camille@gmail.com>2025-07-03 14:59:27 +0000
commit3380bfd1a00fe3f85e8597bfdb9ad4d65df75da9 (patch)
tree4f7f10aa2d1f4a6a111dfdaf76515fdfe4b3e127 /compiler/rustc_ast/src/ast.rs
parent6268d0aa34b46981533b09827c1454b8cf27e032 (diff)
downloadrust-3380bfd1a00fe3f85e8597bfdb9ad4d65df75da9.tar.gz
rust-3380bfd1a00fe3f85e8597bfdb9ad4d65df75da9.zip
Replace kw_span by full span.
Diffstat (limited to 'compiler/rustc_ast/src/ast.rs')
-rw-r--r--compiler/rustc_ast/src/ast.rs9
1 files changed, 3 insertions, 6 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,
         }
     }
 }