diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2015-08-11 17:27:05 -0700 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2015-08-12 14:55:17 -0700 |
| commit | 8d90d3f36871a00023cc1f313f91e351c287ca15 (patch) | |
| tree | 2d9b616a2468117aa3afe1f6b1f910ff3116776b /src/libsyntax | |
| parent | d07d465cf60033e35eba16b9e431471d54c712f4 (diff) | |
| download | rust-8d90d3f36871a00023cc1f313f91e351c287ca15.tar.gz rust-8d90d3f36871a00023cc1f313f91e351c287ca15.zip | |
Remove all unstable deprecated functionality
This commit removes all unstable and deprecated functions in the standard library. A release was recently cut (1.3) which makes this a good time for some spring cleaning of the deprecated functions.
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/attr.rs | 24 | ||||
| -rw-r--r-- | src/libsyntax/lib.rs | 2 |
2 files changed, 18 insertions, 8 deletions
diff --git a/src/libsyntax/attr.rs b/src/libsyntax/attr.rs index ed3ee768708..399a529af15 100644 --- a/src/libsyntax/attr.rs +++ b/src/libsyntax/attr.rs @@ -10,9 +10,6 @@ // Functions dealing with attributes and meta items -// BitSet -#![allow(deprecated)] - pub use self::StabilityLevel::*; pub use self::ReprAttr::*; pub use self::IntType::*; @@ -28,20 +25,33 @@ use parse::token; use ptr::P; use std::cell::{RefCell, Cell}; -use std::collections::BitSet; use std::collections::HashSet; use std::fmt; -thread_local! { static USED_ATTRS: RefCell<BitSet> = RefCell::new(BitSet::new()) } +thread_local! { + static USED_ATTRS: RefCell<Vec<u64>> = RefCell::new(Vec::new()) +} pub fn mark_used(attr: &Attribute) { let AttrId(id) = attr.node.id; - USED_ATTRS.with(|slot| slot.borrow_mut().insert(id)); + USED_ATTRS.with(|slot| { + let idx = (id / 64) as usize; + let shift = id % 64; + if slot.borrow().len() <= idx { + slot.borrow_mut().resize(idx + 1, 0); + } + slot.borrow_mut()[idx] |= 1 << shift; + }); } pub fn is_used(attr: &Attribute) -> bool { let AttrId(id) = attr.node.id; - USED_ATTRS.with(|slot| slot.borrow().contains(&id)) + USED_ATTRS.with(|slot| { + let idx = (id / 64) as usize; + let shift = id % 64; + slot.borrow().get(idx).map(|bits| bits & (1 << shift) != 0) + .unwrap_or(false) + }) } pub trait AttrMetaMethods { diff --git a/src/libsyntax/lib.rs b/src/libsyntax/lib.rs index 94c920406c4..290efb15195 100644 --- a/src/libsyntax/lib.rs +++ b/src/libsyntax/lib.rs @@ -26,7 +26,6 @@ html_root_url = "https://doc.rust-lang.org/nightly/")] #![feature(associated_consts)] -#![feature(bitset)] #![feature(drain)] #![feature(filling_drop)] #![feature(libc)] @@ -38,6 +37,7 @@ #![feature(str_escape)] #![feature(unicode)] #![feature(vec_push_all)] +#![feature(vec_resize)] extern crate fmt_macros; extern crate serialize; |
