use std::cell::{RefCell, Cell};
use std::collections::BitvSet;
use std::collections::HashSet;
+use std::fmt;
thread_local! { static USED_ATTRS: RefCell<BitvSet> = RefCell::new(BitvSet::new()) }
fn meta_item_list<'a>(&'a self) -> Option<&'a [P<MetaItem>]> {
match self.node {
- MetaList(_, ref l) => Some(l.index(&FullRange)),
+ MetaList(_, ref l) => Some(&l[]),
_ => None
}
}
let comment = self.value_str().unwrap();
let meta = mk_name_value_item_str(
InternedString::new("doc"),
- token::intern_and_get_ident(strip_doc_comment_decoration(
- comment.get()).index(&FullRange)));
+ token::intern_and_get_ident(&strip_doc_comment_decoration(
+ comment.get())[]));
if self.node.style == ast::AttrOuter {
f(&mk_attr_outer(self.node.id, meta))
} else {
P(dummy_spanned(MetaWord(name)))
}
-thread_local! { static NEXT_ATTR_ID: Cell<uint> = Cell::new(0) }
+thread_local! { static NEXT_ATTR_ID: Cell<usize> = Cell::new(0) }
pub fn mk_attr_id() -> AttrId {
let id = NEXT_ATTR_ID.with(|slot| {
}
MetaList(ref n, ref items) if *n == "inline" => {
mark_used(attr);
- if contains_name(items.index(&FullRange), "always") {
+ if contains_name(&items[], "always") {
InlineAlways
- } else if contains_name(items.index(&FullRange), "never") {
+ } else if contains_name(&items[], "never") {
InlineNever
} else {
InlineHint
Locked
}
+impl fmt::String for StabilityLevel {
+ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fmt::Show::fmt(self, f)
+ }
+}
+
pub fn find_stability_generic<'a,
AM: AttrMetaMethods,
I: Iterator<Item=&'a AM>>
if !set.insert(name.clone()) {
diagnostic.span_fatal(meta.span,
- format!("duplicate meta item `{}`", name).index(&FullRange));
+ &format!("duplicate meta item `{}`", name)[]);
}
}
}
"u32" => Some(UnsignedInt(ast::TyU32)),
"i64" => Some(SignedInt(ast::TyI64)),
"u64" => Some(UnsignedInt(ast::TyU64)),
- "int" => Some(SignedInt(ast::TyI)),
- "uint" => Some(UnsignedInt(ast::TyU)),
+ "int" => Some(SignedInt(ast::TyIs(true))),
+ "uint" => Some(UnsignedInt(ast::TyUs(true))),
+ "isize" => Some(SignedInt(ast::TyIs(false))),
+ "usize" => Some(UnsignedInt(ast::TyUs(false))),
_ => None
}
}
SignedInt(ast::TyI16) | UnsignedInt(ast::TyU16) |
SignedInt(ast::TyI32) | UnsignedInt(ast::TyU32) |
SignedInt(ast::TyI64) | UnsignedInt(ast::TyU64) => true,
- SignedInt(ast::TyI) | UnsignedInt(ast::TyU) => false
+ SignedInt(ast::TyIs(_)) | UnsignedInt(ast::TyUs(_)) => false
}
}
}