diff options
author | Josh Matthews <josh@joshmatthews.net> | 2015-01-15 13:26:44 -0500 |
---|---|---|
committer | Glenn Watson <gw@intuitionlibrary.com> | 2015-01-28 10:16:49 +1000 |
commit | 95fc29fa0db21959df99d81cdbb9561226321d2f (patch) | |
tree | a48e171165ec155062ef13c550b2c0f72d127425 /components/plugins | |
parent | ff8cbff81016c157373c1675f3eee69dd70ae544 (diff) | |
download | servo-95fc29fa0db21959df99d81cdbb9561226321d2f.tar.gz servo-95fc29fa0db21959df99d81cdbb9561226321d2f.zip |
Update rustc to 00b112c45a604fa6f4b59af2a40c9deeadfdb7c6/rustc-1.0.0-dev.
Diffstat (limited to 'components/plugins')
-rw-r--r-- | components/plugins/jstraceable.rs | 12 | ||||
-rw-r--r-- | components/plugins/lib.rs | 29 | ||||
-rw-r--r-- | components/plugins/lints/ban.rs | 2 | ||||
-rw-r--r-- | components/plugins/lints/inheritance_integrity.rs | 2 | ||||
-rw-r--r-- | components/plugins/lints/privatize.rs | 2 | ||||
-rw-r--r-- | components/plugins/lints/str_to_string.rs | 2 | ||||
-rw-r--r-- | components/plugins/lints/transmute_type.rs | 2 | ||||
-rw-r--r-- | components/plugins/lints/unrooted_must_root.rs | 4 | ||||
-rw-r--r-- | components/plugins/reflector.rs | 2 | ||||
-rw-r--r-- | components/plugins/utils.rs | 4 |
10 files changed, 21 insertions, 40 deletions
diff --git a/components/plugins/jstraceable.rs b/components/plugins/jstraceable.rs index fb06b6a649a..47f2c99d274 100644 --- a/components/plugins/jstraceable.rs +++ b/components/plugins/jstraceable.rs @@ -15,7 +15,7 @@ use syntax::parse::token::InternedString; pub fn expand_dom_struct(_: &mut ExtCtxt, _: Span, _: &MetaItem, item: P<Item>) -> P<Item> { let mut item2 = (*item).clone(); { - let add_attr = |s| { + let mut add_attr = |&mut :s| { item2.attrs.push(attr::mk_attr_outer(attr::mk_attr_id(), attr::mk_word_item(InternedString::new(s)))); }; add_attr("must_root"); @@ -34,7 +34,7 @@ pub fn expand_dom_struct(_: &mut ExtCtxt, _: Span, _: &MetaItem, item: P<Item>) /// Provides the hook to expand `#[jstraceable]` into an implementation of `JSTraceable` /// /// The expansion basically calls `trace()` on all of the fields of the struct/enum, erroring if they do not implement the method. -pub fn expand_jstraceable(cx: &mut ExtCtxt, span: Span, mitem: &MetaItem, item: &Item, push: |P<Item>|) { +pub fn expand_jstraceable(cx: &mut ExtCtxt, span: Span, mitem: &MetaItem, item: &Item, mut push: Box<FnMut(P<Item>)>) { let trait_def = TraitDef { span: span, attributes: Vec::new(), @@ -51,13 +51,11 @@ pub fn expand_jstraceable(cx: &mut ExtCtxt, span: Span, mitem: &MetaItem, item: attributes: vec!(attr::mk_attr_outer(attr::mk_attr_id(), attr::mk_name_value_item_str(InternedString::new("inline"), InternedString::new("always")))), - combine_substructure: combine_substructure(|a, b, c| { - jstraceable_substructure(a, b, c) - }) + combine_substructure: combine_substructure(box jstraceable_substructure) } ) }; - trait_def.expand(cx, mitem, item, push) + trait_def.expand(cx, mitem, item, |:a| push(a)) } // Mostly copied from syntax::ext::deriving::hash @@ -68,7 +66,7 @@ fn jstraceable_substructure(cx: &mut ExtCtxt, trait_span: Span, substr: &Substru _ => cx.span_bug(trait_span, "incorrect number of arguments in `jstraceable`") }; let trace_ident = substr.method_ident; - let call_trace = |span, thing_expr| { + let call_trace = |&:span, thing_expr| { let expr = cx.expr_method_call(span, thing_expr, trace_ident, vec!(state_expr.clone())); cx.stmt_expr(expr) }; diff --git a/components/plugins/lib.rs b/components/plugins/lib.rs index f6494eadfd3..6190114ac39 100644 --- a/components/plugins/lib.rs +++ b/components/plugins/lib.rs @@ -12,15 +12,18 @@ //! - `#[dom_struct]` : Implies `#[privatize]`,`#[jstraceable]`, and `#[must_root]`. //! Use this for structs that correspond to a DOM type -#![feature(macro_rules, plugin_registrar, quote, phase)] +#![feature(plugin_registrar, quote, plugin, box_syntax)] #![deny(unused_imports)] #![deny(unused_variables)] #![allow(missing_copy_implementations)] +#![allow(unstable)] -#[phase(plugin,link)] +#[plugin] +#[macro_use] extern crate syntax; -#[phase(plugin, link)] +#[plugin] +#[macro_use] extern crate rustc; use rustc::lint::LintPassObject; @@ -50,23 +53,3 @@ pub fn plugin_registrar(reg: &mut Registry) { reg.register_lint_pass(box lints::str_to_string::StrToStringPass as LintPassObject); reg.register_lint_pass(box lints::ban::BanPass as LintPassObject); } - - -#[macro_export] -macro_rules! match_ignore_ascii_case { - ( $value: expr: $( $string: expr => $result: expr ),+ _ => $fallback: expr, ) => { - match_ignore_ascii_case! { $value: - $( $string => $result ),+ - _ => $fallback - } - }; - ( $value: expr: $( $string: expr => $result: expr ),+ _ => $fallback: expr ) => { - { - use std::ascii::AsciiExt; - match $value.as_slice() { - $( s if s.eq_ignore_ascii_case($string) => $result, )+ - _ => $fallback - } - } - }; -} diff --git a/components/plugins/lints/ban.rs b/components/plugins/lints/ban.rs index 78761c274f4..a4c3b7cea07 100644 --- a/components/plugins/lints/ban.rs +++ b/components/plugins/lints/ban.rs @@ -7,7 +7,7 @@ use rustc::lint::{Context, LintPass, LintArray}; use utils::match_ty_unwrap; declare_lint!(BANNED_TYPE, Deny, - "Ban various unsafe type combinations") + "Ban various unsafe type combinations"); /// Lint for banning various unsafe types /// diff --git a/components/plugins/lints/inheritance_integrity.rs b/components/plugins/lints/inheritance_integrity.rs index fa3f42770f0..d806b1cad1c 100644 --- a/components/plugins/lints/inheritance_integrity.rs +++ b/components/plugins/lints/inheritance_integrity.rs @@ -9,7 +9,7 @@ use rustc::middle::{ty, def}; use utils::match_lang_ty; declare_lint!(INHERITANCE_INTEGRITY, Deny, - "Ensures that struct fields are properly laid out for inheritance to work") + "Ensures that struct fields are properly laid out for inheritance to work"); /// Lint for ensuring proper layout of DOM structs /// diff --git a/components/plugins/lints/privatize.rs b/components/plugins/lints/privatize.rs index 379fa946b43..475338dee07 100644 --- a/components/plugins/lints/privatize.rs +++ b/components/plugins/lints/privatize.rs @@ -9,7 +9,7 @@ use rustc::lint::{Context, LintPass, LintArray}; use rustc::middle::ty; declare_lint!(PRIVATIZE, Deny, - "Allows to enforce private fields for struct definitions") + "Allows to enforce private fields for struct definitions"); /// Lint for keeping DOM fields private /// diff --git a/components/plugins/lints/str_to_string.rs b/components/plugins/lints/str_to_string.rs index d6272f4d629..d93268844e0 100644 --- a/components/plugins/lints/str_to_string.rs +++ b/components/plugins/lints/str_to_string.rs @@ -8,7 +8,7 @@ use rustc::middle::ty::expr_ty; use rustc::middle::ty; declare_lint!(STR_TO_STRING, Deny, - "Warn when a String could use to_owned() instead of to_string()") + "Warn when a String could use to_owned() instead of to_string()"); /// Prefer str.to_owned() over str.to_string() /// diff --git a/components/plugins/lints/transmute_type.rs b/components/plugins/lints/transmute_type.rs index 674f14c3c7d..6facd362108 100644 --- a/components/plugins/lints/transmute_type.rs +++ b/components/plugins/lints/transmute_type.rs @@ -9,7 +9,7 @@ use rustc::middle::ty::expr_ty; use rustc::util::ppaux::Repr; declare_lint!(TRANSMUTE_TYPE_LINT, Allow, - "Warn and report types being transmuted") + "Warn and report types being transmuted"); /// Lint for auditing transmutes /// diff --git a/components/plugins/lints/unrooted_must_root.rs b/components/plugins/lints/unrooted_must_root.rs index 636ff472fff..80b37a714ba 100644 --- a/components/plugins/lints/unrooted_must_root.rs +++ b/components/plugins/lints/unrooted_must_root.rs @@ -11,7 +11,7 @@ use rustc::util::ppaux::Repr; use utils::unsafe_context; declare_lint!(UNROOTED_MUST_ROOT, Deny, - "Warn and report usage of unrooted jsmanaged objects") + "Warn and report usage of unrooted jsmanaged objects"); /// Lint for ensuring safe usage of unrooted pointers /// @@ -84,7 +84,7 @@ impl LintPass for UnrootedPass { return; }, visit::FkItemFn(_, _, style, _) => match style { - ast::UnsafeFn => return, + ast::Unsafety::Unsafe => return, _ => () }, _ => () diff --git a/components/plugins/reflector.rs b/components/plugins/reflector.rs index 4b0681c4d39..43f2f625df4 100644 --- a/components/plugins/reflector.rs +++ b/components/plugins/reflector.rs @@ -10,7 +10,7 @@ use syntax::ast; use utils::match_ty_unwrap; -pub fn expand_reflector(cx: &mut ExtCtxt, span: Span, _: &MetaItem, item: &Item, push: |P<Item>|) { +pub fn expand_reflector(cx: &mut ExtCtxt, span: Span, _: &MetaItem, item: &Item, mut push: Box<FnMut(P<Item>) -> ()>) { if let ast::ItemStruct(ref def, _) = item.node { let struct_name = item.ident; // This path has to be hardcoded, unfortunately, since we can't resolve paths at expansion time diff --git a/components/plugins/utils.rs b/components/plugins/utils.rs index 6f7f00f9109..e9db633f2d4 100644 --- a/components/plugins/utils.rs +++ b/components/plugins/utils.rs @@ -70,7 +70,7 @@ pub fn unsafe_context(map: &ast_map::Map, id: ast::NodeId) -> bool { match *itm { ast::MethodImplItem(ref meth) => match meth.node { ast::MethDecl(_, _, _, _, style, _, _, _) => match style { - ast::UnsafeFn => true, + ast::Unsafety::Unsafe => true, _ => false, }, _ => false, @@ -81,7 +81,7 @@ pub fn unsafe_context(map: &ast_map::Map, id: ast::NodeId) -> bool { Some(ast_map::NodeItem(itm)) => { match itm.node { ast::ItemFn(_, style, _, _, _) => match style { - ast::UnsafeFn => true, + ast::Unsafety::Unsafe => true, _ => false, }, _ => false, |