Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
8e88d64
Added test for #49579.
davidtwco Jul 28, 2018
6d5694a
fix memrchr in miri
RalfJung Jul 30, 2018
d5f1f70
Fix Alias intra doc ICE
GuillaumeGomez Jul 29, 2018
f985e6c
tests/ui: Add missing mips{64} ignores
Jul 31, 2018
38e311e
Use SetLenOnDrop in Vec::truncate()
lnicola Jul 31, 2018
d94bdf8
Put back original field discovery
GuillaumeGomez Jul 31, 2018
84dc485
Allow borrow conflicts for promoted length 0 arrays
matthewjasper Jul 31, 2018
0babbf1
Don't count MIR locals as borrowed after StorageDead when finding loc…
Zoxc Jul 31, 2018
dbc0cd9
rustc_resolve: record single-segment extern crate import resolutions.
eddyb Aug 1, 2018
e462c06
Another SmallVec.extend optimization
llogiq Aug 1, 2018
b5ed39f
Implement custom read_to_end for io::Take
ljedrz Aug 1, 2018
1d64b24
Switch syntax attribute tracking to BitVector
Mark-Simulacrum Jul 30, 2018
9bc4fbb
Split out growth functionality into BitVector type
Mark-Simulacrum Jul 30, 2018
27b3cb5
rustc: Trim down the `rust_2018_idioms` lint group
alexcrichton Jul 31, 2018
c2d57db
1.27 actually added the `armv5te-unknown-linux-musleabi` target
Susurrus Aug 1, 2018
8bbf042
Added test for #49824.
davidtwco Jul 27, 2018
f685142
async can begin expressions
cramertj Aug 1, 2018
334da29
Rollup merge of #52793 - davidtwco:issue-49824, r=pnkfelix
pietroalbini Aug 1, 2018
42243f8
Rollup merge of #52799 - Mark-Simulacrum:attr-id-bitvecs, r=michaelwo…
pietroalbini Aug 1, 2018
4d1ddfe
Rollup merge of #52809 - davidtwco:issue-49579, r=pnkfelix
pietroalbini Aug 1, 2018
d5fcd27
Rollup merge of #52834 - matthewjasper:allow-zst-conflicts, r=pnkfelix
pietroalbini Aug 1, 2018
f52ef3b
Rollup merge of #52835 - GuillaumeGomez:ice-rustdoc-links, r=eddyb
pietroalbini Aug 1, 2018
e3928cc
Rollup merge of #52854 - RalfJung:memrchr, r=Kimundi
pietroalbini Aug 1, 2018
3ae03e9
Rollup merge of #52899 - draganmladjenovic:ui_tests64, r=alexcrichton
pietroalbini Aug 1, 2018
1997c70
Rollup merge of #52908 - lnicola:vec-truncate-opt, r=alexcrichton
pietroalbini Aug 1, 2018
b40b899
Rollup merge of #52915 - Zoxc:refine-gen-borrow-analysis, r=eddyb
pietroalbini Aug 1, 2018
110b71a
Rollup merge of #52926 - alexcrichton:trim-idioms-lints, r=oli-obk
pietroalbini Aug 1, 2018
2893bd0
Rollup merge of #52930 - eddyb:issue-52489, r=cramertj
pietroalbini Aug 1, 2018
eeb7b6a
Rollup merge of #52939 - ljedrz:fix_51746, r=kennytm
pietroalbini Aug 1, 2018
6e7e385
Rollup merge of #52942 - llogiq:smallvec-opt, r=Mark-Simulacrum
pietroalbini Aug 1, 2018
b2392fa
Rollup merge of #52947 - Susurrus:patch-1, r=alexcrichton
pietroalbini Aug 1, 2018
3e7897f
Rollup merge of #52954 - cramertj:async-parse, r=petrochenkov
pietroalbini Aug 1, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Switch syntax attribute tracking to BitVector
  • Loading branch information
Mark-Simulacrum committed Aug 1, 2018
commit 1d64b241cdca1477cc4c87b3751326212ebf78f6
12 changes: 11 additions & 1 deletion src/libsyntax/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ use ext::hygiene::{Mark, SyntaxContext};
use print::pprust;
use ptr::P;
use rustc_data_structures::indexed_vec;
use rustc_data_structures::indexed_vec::Idx;
use symbol::{Symbol, keywords};
use tokenstream::{ThinTokenStream, TokenStream};

Expand Down Expand Up @@ -1910,9 +1911,18 @@ pub enum AttrStyle {
Inner,
}

#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug, Copy)]
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug, PartialOrd, Ord, Copy)]
pub struct AttrId(pub usize);

impl Idx for AttrId {
fn new(idx: usize) -> Self {
AttrId(idx)
}
fn index(self) -> usize {
self.0
}
}

/// Meta-data associated with an item
/// Doc-comments are promoted to attributes that have is_sugared_doc = true
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
Expand Down
32 changes: 4 additions & 28 deletions src/libsyntax/attr/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,51 +41,27 @@ use std::iter;

pub fn mark_used(attr: &Attribute) {
debug!("Marking {:?} as used.", attr);
let AttrId(id) = attr.id;
GLOBALS.with(|globals| {
let mut slot = globals.used_attrs.lock();
let idx = (id / 64) as usize;
let shift = id % 64;
if slot.len() <= idx {
slot.resize(idx + 1, 0);
}
slot[idx] |= 1 << shift;
globals.used_attrs.lock().insert(attr.id);
});
}

pub fn is_used(attr: &Attribute) -> bool {
let AttrId(id) = attr.id;
GLOBALS.with(|globals| {
let slot = globals.used_attrs.lock();
let idx = (id / 64) as usize;
let shift = id % 64;
slot.get(idx).map(|bits| bits & (1 << shift) != 0)
.unwrap_or(false)
globals.used_attrs.lock().contains(attr.id)
})
}

pub fn mark_known(attr: &Attribute) {
debug!("Marking {:?} as known.", attr);
let AttrId(id) = attr.id;
GLOBALS.with(|globals| {
let mut slot = globals.known_attrs.lock();
let idx = (id / 64) as usize;
let shift = id % 64;
if slot.len() <= idx {
slot.resize(idx + 1, 0);
}
slot[idx] |= 1 << shift;
globals.known_attrs.lock().insert(attr.id);
});
}

pub fn is_known(attr: &Attribute) -> bool {
let AttrId(id) = attr.id;
GLOBALS.with(|globals| {
let slot = globals.known_attrs.lock();
let idx = (id / 64) as usize;
let shift = id % 64;
slot.get(idx).map(|bits| bits & (1 << shift) != 0)
.unwrap_or(false)
globals.known_attrs.lock().contains(attr.id)
})
}

Expand Down
12 changes: 8 additions & 4 deletions src/libsyntax/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ extern crate rustc_target;
extern crate serialize as rustc_serialize; // used by deriving

use rustc_data_structures::sync::Lock;
use rustc_data_structures::bitvec::BitVector;
use ast::AttrId;

// A variant of 'try!' that panics on an Err. This is used as a crutch on the
// way towards a non-panic!-prone parser. It should be used for fatal parsing
Expand Down Expand Up @@ -75,16 +77,18 @@ macro_rules! unwrap_or {
}

pub struct Globals {
used_attrs: Lock<Vec<u64>>,
known_attrs: Lock<Vec<u64>>,
used_attrs: Lock<BitVector<AttrId>>,
known_attrs: Lock<BitVector<AttrId>>,
syntax_pos_globals: syntax_pos::Globals,
}

impl Globals {
fn new() -> Globals {
Globals {
used_attrs: Lock::new(Vec::new()),
known_attrs: Lock::new(Vec::new()),
// We have no idea how many attributes their will be, so just
// initiate the vectors with 0 bits. We'll grow them as necessary.
used_attrs: Lock::new(BitVector::new(0)),
known_attrs: Lock::new(BitVector::new(0)),
syntax_pos_globals: syntax_pos::Globals::new(),
}
}
Expand Down