mirror of
https://github.com/rust-lang/rust.git
synced 2025-04-28 11:07:42 +00:00
Add Const kind to AST
Co-Authored-By: Gabriel Smith <yodaldevoid@users.noreply.github.com>
This commit is contained in:
parent
ad433894ab
commit
751dcdf606
@ -167,6 +167,17 @@ impl GenericArgs {
|
|||||||
pub enum GenericArg {
|
pub enum GenericArg {
|
||||||
Lifetime(Lifetime),
|
Lifetime(Lifetime),
|
||||||
Type(P<Ty>),
|
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>`
|
/// A path like `Foo<'a, T>`
|
||||||
@ -300,9 +311,8 @@ pub type GenericBounds = Vec<GenericBound>;
|
|||||||
pub enum GenericParamKind {
|
pub enum GenericParamKind {
|
||||||
/// A lifetime definition (e.g., `'a: 'b + 'c + 'd`).
|
/// A lifetime definition (e.g., `'a: 'b + 'c + 'd`).
|
||||||
Lifetime,
|
Lifetime,
|
||||||
Type {
|
Type { default: Option<P<Ty>> },
|
||||||
default: Option<P<Ty>>,
|
Const { ty: P<Ty> },
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||||
|
Loading…
Reference in New Issue
Block a user