Skip to content

Commit 751dcdf

Browse files
varkoryodaldevoid
andcommitted
Add Const kind to AST
Co-Authored-By: Gabriel Smith <[email protected]>
1 parent ad43389 commit 751dcdf

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

src/libsyntax/ast.rs

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,17 @@ impl GenericArgs {
167167
pub enum GenericArg {
168168
Lifetime(Lifetime),
169169
Type(P<Ty>),
170+
Const(AnonConst),
171+
}
172+
173+
impl GenericArg {
174+
pub fn span(&self) -> Span {
175+
match self {
176+
GenericArg::Lifetime(lt) => lt.ident.span,
177+
GenericArg::Type(ty) => ty.span,
178+
GenericArg::Const(ct) => ct.value.span,
179+
}
180+
}
170181
}
171182

172183
/// A path like `Foo<'a, T>`
@@ -300,9 +311,8 @@ pub type GenericBounds = Vec<GenericBound>;
300311
pub enum GenericParamKind {
301312
/// A lifetime definition (e.g., `'a: 'b + 'c + 'd`).
302313
Lifetime,
303-
Type {
304-
default: Option<P<Ty>>,
305-
},
314+
Type { default: Option<P<Ty>> },
315+
Const { ty: P<Ty> },
306316
}
307317

308318
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]

0 commit comments

Comments
 (0)