diff options
| author | varkor <github@varkor.com> | 2019-02-05 16:48:45 +0100 |
|---|---|---|
| committer | varkor <github@varkor.com> | 2019-02-07 15:02:16 +0100 |
| commit | 751dcdf606d4ff3b27b1c820535304bfb022170c (patch) | |
| tree | 1bf7bd3afbfcf1f51351cbb954f22e2d6bd5d411 /src/libsyntax | |
| parent | ad433894abd4231fb2102416a520ae995ee09aed (diff) | |
| download | rust-751dcdf606d4ff3b27b1c820535304bfb022170c.tar.gz rust-751dcdf606d4ff3b27b1c820535304bfb022170c.zip | |
Add Const kind to AST
Co-Authored-By: Gabriel Smith <yodaldevoid@users.noreply.github.com>
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/ast.rs | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index 2cfe2cc896c..57a3bf86b0e 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -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)] |
