Add Const kind to AST

Co-Authored-By: Gabriel Smith <yodaldevoid@users.noreply.github.com>
This commit is contained in:
varkor 2019-02-05 16:48:45 +01:00
parent ad433894ab
commit 751dcdf606

View File

@ -167,6 +167,17 @@ impl GenericArgs {
pub enum GenericArg {
Lifetime(Lifetime),
Type(P<Ty>),
Const(AnonConst),
}
impl GenericArg {
pub fn span(&self) -> Span {
match self {
GenericArg::Lifetime(lt) => lt.ident.span,
GenericArg::Type(ty) => ty.span,
GenericArg::Const(ct) => ct.value.span,
}
}
}
/// A path like `Foo<'a, T>`
@ -300,9 +311,8 @@ pub type GenericBounds = Vec<GenericBound>;
pub enum GenericParamKind {
/// A lifetime definition (e.g., `'a: 'b + 'c + 'd`).
Lifetime,
Type {
default: Option<P<Ty>>,
},
Type { default: Option<P<Ty>> },
Const { ty: P<Ty> },
}
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]