Upgrade to rustc ba2f13ef0 2015-02-04

This commit is contained in:
Simon Sapin 2015-01-31 14:36:05 +01:00 committed by Matt Brubeck
parent bc6882bdef
commit d5dd1d658e
136 changed files with 1091 additions and 878 deletions

View file

@ -47,7 +47,7 @@ fn expand_cased<'cx, T>(cx: &'cx mut ExtCtxt, sp: Span, tts: &[ast::TokenTree],
};
match (res, it.count()) {
(Some((s, span)), 0) => {
let new_s = s.get().chars().map(transform).collect::<String>();
let new_s = s.chars().map(transform).collect::<String>();
base::MacExpr::new(cx.expr_str(span, token::intern_and_get_ident(new_s.as_slice())))
}
(_, rest) => {

View file

@ -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 mut add_attr = |&mut :s| {
let mut add_attr = |s| {
item2.attrs.push(attr::mk_attr_outer(attr::mk_attr_id(), attr::mk_word_item(InternedString::new(s))));
};
add_attr("must_root");
@ -41,7 +41,7 @@ pub fn expand_jstraceable(cx: &mut ExtCtxt, span: Span, mitem: &MetaItem, item:
path: ty::Path::new(vec!("dom","bindings","trace","JSTraceable")),
additional_bounds: Vec::new(),
generics: ty::LifetimeBounds::empty(),
methods: vec!(
methods: vec![
MethodDef {
name: "trace",
generics: ty::LifetimeBounds::empty(),
@ -53,9 +53,10 @@ pub fn expand_jstraceable(cx: &mut ExtCtxt, span: Span, mitem: &MetaItem, item:
InternedString::new("always")))),
combine_substructure: combine_substructure(box jstraceable_substructure)
}
)
],
associated_types: vec![],
};
trait_def.expand(cx, mitem, item, |:a| push(a))
trait_def.expand(cx, mitem, item, |a| push(a))
}
// Mostly copied from syntax::ext::deriving::hash
@ -66,7 +67,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)
};

View file

@ -12,10 +12,9 @@
//! - `#[dom_struct]` : Implies `#[privatize]`,`#[jstraceable]`, and `#[must_root]`.
//! Use this for structs that correspond to a DOM type
#![feature(plugin_registrar, quote, plugin, box_syntax)]
#![feature(plugin_registrar, quote, plugin, box_syntax, rustc_private, core)]
#![allow(missing_copy_implementations)]
#![allow(unstable)]
#[plugin]
#[macro_use]

View file

@ -42,21 +42,19 @@ pub fn match_lang_ty(cx: &Context, ty: &Ty, value: &str) -> bool {
if let TyPath(_, ty_id) = ty.node {
if let Some(def::DefTy(def_id, _)) = cx.tcx.def_map.borrow().get(&ty_id).cloned() {
// Iterating through attributes is hard because of cross-crate defs
ty::each_attr(cx.tcx, def_id, |attr| {
for attr in ty::get_attrs(cx.tcx, def_id).iter() {
if let ast::MetaNameValue(ref name, ref val) = attr.node.value.node {
if name.get() == "servo_lang" {
if &**name == "servo_lang" {
if let ast::LitStr(ref v, _) = val.node {
if v.get() == value {
if &**v == value {
mark_used(attr);
found = true;
// We're done with the loop
return false;
break
}
}
}
}
true
});
}
};
}
found