diff options
| author | bors <bors@rust-lang.org> | 2014-04-08 08:16:52 -0700 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2014-04-08 08:16:52 -0700 |
| commit | 02f51211eddbbaf6c6e02cecc78957ce1d5b4600 (patch) | |
| tree | d7c5f1dbc4a37e473577b39abd56e2f1df433069 /src/libsyntax | |
| parent | e415c25bcd81dc1f9a5a3d25d9b48ed2d545336b (diff) | |
| parent | da8d4fddc6445c19ad434a1f104c1c310c6c3c34 (diff) | |
| download | rust-02f51211eddbbaf6c6e02cecc78957ce1d5b4600.tar.gz rust-02f51211eddbbaf6c6e02cecc78957ce1d5b4600.zip | |
auto merge of #13397 : alexcrichton/rust/rollup, r=alexcrichton
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/ast_util.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/ext/base.rs | 5 | ||||
| -rw-r--r-- | src/libsyntax/ext/deriving/generic.rs | 6 | ||||
| -rw-r--r-- | src/libsyntax/ext/expand.rs | 16 | ||||
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 49 |
5 files changed, 27 insertions, 51 deletions
diff --git a/src/libsyntax/ast_util.rs b/src/libsyntax/ast_util.rs index 631489a65b2..ec9c02ac82a 100644 --- a/src/libsyntax/ast_util.rs +++ b/src/libsyntax/ast_util.rs @@ -613,7 +613,7 @@ pub trait EachViewItem { } struct EachViewItemData<'a> { - callback: 'a |&ast::ViewItem| -> bool, + callback: |&ast::ViewItem|: 'a -> bool, } impl<'a> Visitor<()> for EachViewItemData<'a> { diff --git a/src/libsyntax/ext/base.rs b/src/libsyntax/ext/base.rs index 7ff77923132..3bf1ed95f38 100644 --- a/src/libsyntax/ext/base.rs +++ b/src/libsyntax/ext/base.rs @@ -293,13 +293,12 @@ pub fn syntax_expander_table() -> SyntaxEnv { pub struct MacroCrate { pub lib: Option<Path>, - pub cnum: ast::CrateNum, + pub macros: Vec<~str>, + pub registrar_symbol: Option<~str>, } pub trait CrateLoader { fn load_crate(&mut self, krate: &ast::ViewItem) -> MacroCrate; - fn get_exported_macros(&mut self, crate_num: ast::CrateNum) -> Vec<~str> ; - fn get_registrar_symbol(&mut self, crate_num: ast::CrateNum) -> Option<~str>; } // One of these is made during expansion and incrementally updated as we go; diff --git a/src/libsyntax/ext/deriving/generic.rs b/src/libsyntax/ext/deriving/generic.rs index 0d851647b3d..1dcb753624d 100644 --- a/src/libsyntax/ext/deriving/generic.rs +++ b/src/libsyntax/ext/deriving/generic.rs @@ -303,7 +303,7 @@ Combine the values of all the fields together. The last argument is all the fields of all the structures, see above for details. */ pub type CombineSubstructureFunc<'a> = - 'a |&mut ExtCtxt, Span, &Substructure| -> @Expr; + |&mut ExtCtxt, Span, &Substructure|: 'a -> @Expr; /** Deal with non-matching enum variants, the arguments are a list @@ -311,10 +311,10 @@ representing each variant: (variant index, ast::Variant instance, [variant fields]), and a list of the nonself args of the type */ pub type EnumNonMatchFunc<'a> = - 'a |&mut ExtCtxt, + |&mut ExtCtxt, Span, &[(uint, P<ast::Variant>, Vec<(Span, Option<Ident>, @Expr)> )], - &[@Expr]| + &[@Expr]|: 'a -> @Expr; diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs index 747ab583e79..1cff1d0f295 100644 --- a/src/libsyntax/ext/expand.rs +++ b/src/libsyntax/ext/expand.rs @@ -487,7 +487,8 @@ pub fn expand_view_item(vi: &ast::ViewItem, } fn load_extern_macros(krate: &ast::ViewItem, fld: &mut MacroExpander) { - let MacroCrate { lib, cnum } = fld.cx.ecfg.loader.load_crate(krate); + let MacroCrate { lib, macros, registrar_symbol } = + fld.cx.ecfg.loader.load_crate(krate); let crate_name = match krate.node { ast::ViewItemExternCrate(name, _, _) => name, @@ -495,8 +496,7 @@ fn load_extern_macros(krate: &ast::ViewItem, fld: &mut MacroExpander) { }; let name = format!("<{} macros>", token::get_ident(crate_name)); - let exported_macros = fld.cx.ecfg.loader.get_exported_macros(cnum); - for source in exported_macros.iter() { + for source in macros.iter() { let item = parse::parse_item_from_source_str(name.clone(), (*source).clone(), fld.cx.cfg(), @@ -512,7 +512,7 @@ fn load_extern_macros(krate: &ast::ViewItem, fld: &mut MacroExpander) { // Make sure the path contains a / or the linker will search for it. let path = os::make_absolute(&path); - let registrar = match fld.cx.ecfg.loader.get_registrar_symbol(cnum) { + let registrar = match registrar_symbol { Some(registrar) => registrar, None => return }; @@ -1019,14 +1019,6 @@ mod test { fn load_crate(&mut self, _: &ast::ViewItem) -> MacroCrate { fail!("lolwut") } - - fn get_exported_macros(&mut self, _: ast::CrateNum) -> Vec<~str> { - fail!("lolwut") - } - - fn get_registrar_symbol(&mut self, _: ast::CrateNum) -> Option<~str> { - fail!("lolwut") - } } // these following tests are quite fragile, in that they don't test what diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 62ce0f1e113..c8ea0b6aac2 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -905,31 +905,23 @@ impl<'a> Parser<'a> { */ - // NOTE: remove after the next stage0 snap - let (decl, lifetimes, bounds) = if self.token == token::COLON { - let (_, bounds) = self.parse_optional_ty_param_bounds(false); - let (decl, lifetimes) = self.parse_ty_fn_decl(false); - (decl, lifetimes, bounds) + let lifetimes = if self.eat(&token::LT) { + let lifetimes = self.parse_lifetimes(); + self.expect_gt(); + lifetimes } else { - let lifetimes = if self.eat(&token::LT) { - let lifetimes = self.parse_lifetimes(); - self.expect_gt(); - lifetimes - } else { - Vec::new() - }; - - let (inputs, variadic) = self.parse_fn_args(false, false); - let (_, bounds) = self.parse_optional_ty_param_bounds(false); - let (ret_style, ret_ty) = self.parse_ret_ty(); - let decl = P(FnDecl { - inputs: inputs, - output: ret_ty, - cf: ret_style, - variadic: variadic - }); - (decl, lifetimes, bounds) + Vec::new() }; + + let (inputs, variadic) = self.parse_fn_args(false, false); + let (_, bounds) = self.parse_optional_ty_param_bounds(false); + let (ret_style, ret_ty) = self.parse_ret_ty(); + let decl = P(FnDecl { + inputs: inputs, + output: ret_ty, + cf: ret_style, + variadic: variadic + }); TyClosure(@ClosureTy { sigil: OwnedSigil, region: None, @@ -957,8 +949,6 @@ impl<'a> Parser<'a> { */ - // NOTE: remove 'let region' after a stage0 snap - let region = self.parse_opt_lifetime(); let purity = self.parse_unsafety(); let onceness = if self.eat_keyword(keywords::Once) {Once} else {Many}; @@ -982,10 +972,7 @@ impl<'a> Parser<'a> { inputs }; - let (new_region, bounds) = self.parse_optional_ty_param_bounds(true); - - // NOTE: this should be removed after a stage0 snap - let region = new_region.or(region); + let (region, bounds) = self.parse_optional_ty_param_bounds(true); let (return_style, output) = self.parse_ret_ty(); let decl = P(FnDecl { @@ -1246,9 +1233,7 @@ impl<'a> Parser<'a> { } else if self.token_is_closure_keyword() || self.token == token::BINOP(token::OR) || self.token == token::OROR || - self.token == token::LT || - // NOTE: remove this clause after a stage0 snap - Parser::token_is_lifetime(&self.token) { + self.token == token::LT { // CLOSURE // // FIXME(pcwalton): Eventually `token::LT` will not unambiguously |
