diff options
| author | Patrick Walton <pcwalton@mimiga.net> | 2014-08-11 09:32:26 -0700 |
|---|---|---|
| committer | Patrick Walton <pcwalton@mimiga.net> | 2014-08-14 14:14:26 -0700 |
| commit | 604af3f6c0be6ea428a55cfcb303fa1cd1c7958d (patch) | |
| tree | 5d4c22c593c4701b829fdaad19e55ff803c84de7 /src/libsyntax/ast.rs | |
| parent | a8c8e3f80fd0355b2bb91337c6ad0bb0a38d5485 (diff) | |
| download | rust-604af3f6c0be6ea428a55cfcb303fa1cd1c7958d.tar.gz rust-604af3f6c0be6ea428a55cfcb303fa1cd1c7958d.zip | |
librustc: Implement simple `where` clauses.
These `where` clauses are accepted everywhere generics are currently accepted and desugar during type collection to the type parameter bounds we have today. A new keyword, `where`, has been added. Therefore, this is a breaking change. Change uses of `where` to other identifiers. [breaking-change]
Diffstat (limited to 'src/libsyntax/ast.rs')
| -rw-r--r-- | src/libsyntax/ast.rs | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index 1ff8ca10fff..c658a5c3192 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -245,6 +245,7 @@ pub struct TyParam { pub struct Generics { pub lifetimes: Vec<LifetimeDef>, pub ty_params: OwnedSlice<TyParam>, + pub where_clause: WhereClause, } impl Generics { @@ -259,9 +260,23 @@ impl Generics { } } +#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash, Show)] +pub struct WhereClause { + pub id: NodeId, + pub predicates: Vec<WherePredicate>, +} + +#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash, Show)] +pub struct WherePredicate { + pub id: NodeId, + pub span: Span, + pub ident: Ident, + pub bounds: OwnedSlice<TyParamBound>, +} + /// The set of MetaItems that define the compilation environment of the crate, /// used to drive conditional compilation -pub type CrateConfig = Vec<Gc<MetaItem>> ; +pub type CrateConfig = Vec<Gc<MetaItem>>; #[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash, Show)] pub struct Crate { |
