Libsyntax has been updated

This commit is contained in:
GuillaumeGomez
2015-02-03 23:31:06 +01:00
parent 12f1f4c546
commit 8b12d3ddf9
26 changed files with 93 additions and 121 deletions

View File

@@ -29,7 +29,6 @@ use std::cell::{RefCell, Cell};
use std::collections::BitvSet;
use std::collections::HashSet;
use std::fmt;
use std::ops::Deref;
thread_local! { static USED_ATTRS: RefCell<BitvSet> = RefCell::new(BitvSet::new()) }
@@ -45,7 +44,7 @@ pub fn is_used(attr: &Attribute) -> bool {
pub trait AttrMetaMethods {
fn check_name(&self, name: &str) -> bool {
name == self.name().deref()
name == &self.name()[]
}
/// Retrieve the name of the meta item, e.g. `foo` in `#[foo]`,
@@ -63,7 +62,7 @@ pub trait AttrMetaMethods {
impl AttrMetaMethods for Attribute {
fn check_name(&self, name: &str) -> bool {
let matches = name == self.name().deref();
let matches = name == &self.name()[];
if matches {
mark_used(self);
}
@@ -143,7 +142,7 @@ impl AttributeMethods for Attribute {
let meta = mk_name_value_item_str(
InternedString::new("doc"),
token::intern_and_get_ident(&strip_doc_comment_decoration(
comment.deref())[]));
&comment[])[]));
if self.node.style == ast::AttrOuter {
f(&mk_attr_outer(self.node.id, meta))
} else {
@@ -210,7 +209,7 @@ pub fn mk_attr_outer(id: AttrId, item: P<MetaItem>) -> Attribute {
pub fn mk_sugared_doc_attr(id: AttrId, text: InternedString, lo: BytePos,
hi: BytePos)
-> Attribute {
let style = doc_comment_style(text.deref());
let style = doc_comment_style(&text[]);
let lit = spanned(lo, hi, ast::LitStr(text, ast::CookedStr));
let attr = Attribute_ {
id: id,
@@ -327,11 +326,11 @@ pub fn requests_inline(attrs: &[Attribute]) -> bool {
/// Tests if a cfg-pattern matches the cfg set
pub fn cfg_matches(diagnostic: &SpanHandler, cfgs: &[P<MetaItem>], cfg: &ast::MetaItem) -> bool {
match cfg.node {
ast::MetaList(ref pred, ref mis) if pred.deref() == "any" =>
ast::MetaList(ref pred, ref mis) if &pred[] == "any" =>
mis.iter().any(|mi| cfg_matches(diagnostic, cfgs, &**mi)),
ast::MetaList(ref pred, ref mis) if pred.deref() == "all" =>
ast::MetaList(ref pred, ref mis) if &pred[] == "all" =>
mis.iter().all(|mi| cfg_matches(diagnostic, cfgs, &**mi)),
ast::MetaList(ref pred, ref mis) if pred.deref() == "not" => {
ast::MetaList(ref pred, ref mis) if &pred[] == "not" => {
if mis.len() != 1 {
diagnostic.span_err(cfg.span, "expected 1 cfg-pattern");
return false;
@@ -383,7 +382,7 @@ fn find_stability_generic<'a,
'outer: for attr in attrs {
let tag = attr.name();
let tag = tag.deref();
let tag = &tag[];
if tag != "deprecated" && tag != "unstable" && tag != "stable" {
continue // not a stability level
}
@@ -405,7 +404,7 @@ fn find_stability_generic<'a,
}
}
}
if meta.name().deref() == "since" {
if &meta.name()[] == "since" {
match meta.value_str() {
Some(v) => since = Some(v),
None => {
@@ -414,7 +413,7 @@ fn find_stability_generic<'a,
}
}
}
if meta.name().deref() == "reason" {
if &meta.name()[] == "reason" {
match meta.value_str() {
Some(v) => reason = Some(v),
None => {
@@ -522,11 +521,11 @@ pub fn find_repr_attrs(diagnostic: &SpanHandler, attr: &Attribute) -> Vec<ReprAt
for item in items {
match item.node {
ast::MetaWord(ref word) => {
let hint = match word.deref() {
let hint = match &word[] {
// Can't use "extern" because it's not a lexical identifier.
"C" => Some(ReprExtern),
"packed" => Some(ReprPacked),
_ => match int_type_of_word(word.deref()) {
_ => match int_type_of_word(&word[]) {
Some(ity) => Some(ReprInt(item.span, ity)),
None => {
// Not a word we recognize