diff options
| author | Niko Matsakis <niko@alum.mit.edu> | 2014-11-07 06:53:45 -0500 |
|---|---|---|
| committer | Niko Matsakis <niko@alum.mit.edu> | 2014-11-07 15:51:30 -0500 |
| commit | 244231720d29db856c5a28c0dda6c2efd7c9219a (patch) | |
| tree | 41648e7c6c16102a7a602be441b4f1cdad8e7411 /src/libsyntax/ext | |
| parent | c18a1327e3ccf02ae9f755ca280d53177eeb298d (diff) | |
| download | rust-244231720d29db856c5a28c0dda6c2efd7c9219a.tar.gz rust-244231720d29db856c5a28c0dda6c2efd7c9219a.zip | |
Update parser with `for` syntax
Diffstat (limited to 'src/libsyntax/ext')
| -rw-r--r-- | src/libsyntax/ext/build.rs | 15 | ||||
| -rw-r--r-- | src/libsyntax/ext/deriving/generic/ty.rs | 4 |
2 files changed, 13 insertions, 6 deletions
diff --git a/src/libsyntax/ext/build.rs b/src/libsyntax/ext/build.rs index 5921d630b89..862cbf3d7ca 100644 --- a/src/libsyntax/ext/build.rs +++ b/src/libsyntax/ext/build.rs @@ -68,10 +68,11 @@ pub trait AstBuilder { span: Span, id: ast::Ident, bounds: OwnedSlice<ast::TyParamBound>, - unbound: Option<ast::TyParamBound>, + unbound: Option<ast::TraitRef>, default: Option<P<ast::Ty>>) -> ast::TyParam; fn trait_ref(&self, path: ast::Path) -> ast::TraitRef; + fn poly_trait_ref(&self, path: ast::Path) -> ast::PolyTraitRef; fn typarambound(&self, path: ast::Path) -> ast::TyParamBound; fn lifetime(&self, span: Span, ident: ast::Name) -> ast::Lifetime; fn lifetime_def(&self, @@ -417,7 +418,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> { span: Span, id: ast::Ident, bounds: OwnedSlice<ast::TyParamBound>, - unbound: Option<ast::TyParamBound>, + unbound: Option<ast::TraitRef>, default: Option<P<ast::Ty>>) -> ast::TyParam { ast::TyParam { ident: id, @@ -445,12 +446,18 @@ impl<'a> AstBuilder for ExtCtxt<'a> { ast::TraitRef { path: path, ref_id: ast::DUMMY_NODE_ID, - lifetimes: Vec::new(), + } + } + + fn poly_trait_ref(&self, path: ast::Path) -> ast::PolyTraitRef { + ast::PolyTraitRef { + bound_lifetimes: Vec::new(), + trait_ref: self.trait_ref(path) } } fn typarambound(&self, path: ast::Path) -> ast::TyParamBound { - ast::TraitTyParamBound(self.trait_ref(path)) + ast::TraitTyParamBound(self.poly_trait_ref(path)) } fn lifetime(&self, span: Span, name: ast::Name) -> ast::Lifetime { diff --git a/src/libsyntax/ext/deriving/generic/ty.rs b/src/libsyntax/ext/deriving/generic/ty.rs index a90618a30b6..1ec1e3b1224 100644 --- a/src/libsyntax/ext/deriving/generic/ty.rs +++ b/src/libsyntax/ext/deriving/generic/ty.rs @@ -194,7 +194,7 @@ impl<'a> Ty<'a> { fn mk_ty_param(cx: &ExtCtxt, span: Span, name: &str, - bounds: &[Path], unbound: Option<ast::TyParamBound>, + bounds: &[Path], unbound: Option<ast::TraitRef>, self_ident: Ident, self_generics: &Generics) -> ast::TyParam { let bounds = bounds.iter().map(|b| { @@ -220,7 +220,7 @@ fn mk_generics(lifetimes: Vec<ast::LifetimeDef>, ty_params: Vec<ast::TyParam>) #[deriving(Clone)] pub struct LifetimeBounds<'a> { pub lifetimes: Vec<(&'a str, Vec<&'a str>)>, - pub bounds: Vec<(&'a str, Option<ast::TyParamBound>, Vec<Path<'a>>)>, + pub bounds: Vec<(&'a str, Option<ast::TraitRef>, Vec<Path<'a>>)>, } impl<'a> LifetimeBounds<'a> { |
