From 604af3f6c0be6ea428a55cfcb303fa1cd1c7958d Mon Sep 17 00:00:00 2001 From: Patrick Walton Date: Mon, 11 Aug 2014 09:32:26 -0700 Subject: 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] --- src/libsyntax/ast.rs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'src/libsyntax/ast.rs') 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, pub ty_params: OwnedSlice, + 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, +} + +#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash, Show)] +pub struct WherePredicate { + pub id: NodeId, + pub span: Span, + pub ident: Ident, + pub bounds: OwnedSlice, +} + /// The set of MetaItems that define the compilation environment of the crate, /// used to drive conditional compilation -pub type CrateConfig = Vec> ; +pub type CrateConfig = Vec>; #[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash, Show)] pub struct Crate { -- cgit 1.4.1-3-g733a5