From df5c116250657daa98da84eebe1b44a495abf5c0 Mon Sep 17 00:00:00 2001 From: "Felix S. Klock II" Date: Wed, 25 May 2016 15:55:46 +0200 Subject: [PATCH] Alpha rename `OwnIdxSet` to `IdxSetBuf`. --- .../borrowck/mir/dataflow/mod.rs | 14 ++++++------ src/librustc_borrowck/indexed_set.rs | 22 +++++++++---------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/librustc_borrowck/borrowck/mir/dataflow/mod.rs b/src/librustc_borrowck/borrowck/mir/dataflow/mod.rs index da7a85c1a8a..b46b6c368a0 100644 --- a/src/librustc_borrowck/borrowck/mir/dataflow/mod.rs +++ b/src/librustc_borrowck/borrowck/mir/dataflow/mod.rs @@ -21,7 +21,7 @@ use super::MirBorrowckCtxtPreDataflow; use super::MoveDataParamEnv; use bitslice::{bitwise, BitwiseOperator}; -use indexed_set::{Idx, IdxSet, OwnIdxSet}; +use indexed_set::{Idx, IdxSet, IdxSetBuf}; pub use self::sanity_check::sanity_check_via_rustc_peek; pub use self::impls::{MaybeInitializedLvals, MaybeUninitializedLvals}; @@ -57,7 +57,7 @@ impl<'a, 'tcx: 'a, BD> DataflowAnalysis<'a, 'tcx, BD> where BD: BitDenotation + DataflowOperator { fn propagate(&mut self) { - let mut temp = OwnIdxSet::new_empty(self.flow_state.sets.bits_per_block); + let mut temp = IdxSetBuf::new_empty(self.flow_state.sets.bits_per_block); let mut propcx = PropagationContext { builder: self, changed: true, @@ -167,7 +167,7 @@ impl<'a, 'tcx: 'a, BD> MirBorrowckCtxtPreDataflow<'a, 'tcx, BD> /// Maps each block to a set of bits #[derive(Debug)] struct Bits { - bits: OwnIdxSet, + bits: IdxSetBuf, } impl Clone for Bits { @@ -175,7 +175,7 @@ impl Clone for Bits { } impl Bits { - fn new(bits: OwnIdxSet) -> Self { + fn new(bits: IdxSetBuf) -> Self { Bits { bits: bits } } } @@ -393,11 +393,11 @@ impl<'a, 'tcx: 'a, D> DataflowAnalysis<'a, 'tcx, D> let num_blocks = mir.basic_blocks.len(); let num_overall = num_blocks * bits_per_block; - let zeroes = Bits::new(OwnIdxSet::new_empty(num_overall)); + let zeroes = Bits::new(IdxSetBuf::new_empty(num_overall)); let on_entry = Bits::new(if D::bottom_value() { - OwnIdxSet::new_filled(num_overall) + IdxSetBuf::new_filled(num_overall) } else { - OwnIdxSet::new_empty(num_overall) + IdxSetBuf::new_empty(num_overall) }); DataflowAnalysis { diff --git a/src/librustc_borrowck/indexed_set.rs b/src/librustc_borrowck/indexed_set.rs index 2625bd4300c..3fee1dbc056 100644 --- a/src/librustc_borrowck/indexed_set.rs +++ b/src/librustc_borrowck/indexed_set.rs @@ -30,21 +30,21 @@ pub trait Idx: 'static { /// /// In other words, `T` is the type used to index into the bitvector /// this type uses to represent the set of object it holds. -pub struct OwnIdxSet { +pub struct IdxSetBuf { _pd: PhantomData, bits: Vec, } -impl Clone for OwnIdxSet { +impl Clone for IdxSetBuf { fn clone(&self) -> Self { - OwnIdxSet { _pd: PhantomData, bits: self.bits.clone() } + IdxSetBuf { _pd: PhantomData, bits: self.bits.clone() } } } // pnkfelix wants to have this be `IdxSet([Word]) and then pass // around `&mut IdxSet` or `&IdxSet`. // -// WARNING: Mapping a `&OwnIdxSet` to `&IdxSet` (at least today) +// WARNING: Mapping a `&IdxSetBuf` to `&IdxSet` (at least today) // requires a transmute relying on representation guarantees that may // not hold in the future. @@ -58,7 +58,7 @@ pub struct IdxSet { bits: [Word], } -impl fmt::Debug for OwnIdxSet { +impl fmt::Debug for IdxSetBuf { fn fmt(&self, w: &mut fmt::Formatter) -> fmt::Result { self.bits.fmt(w) } } @@ -66,11 +66,11 @@ impl fmt::Debug for IdxSet { fn fmt(&self, w: &mut fmt::Formatter) -> fmt::Result { self.bits.fmt(w) } } -impl OwnIdxSet { +impl IdxSetBuf { fn new(init: Word, universe_size: usize) -> Self { let bits_per_word = mem::size_of::() * 8; let num_words = (universe_size + (bits_per_word - 1)) / bits_per_word; - OwnIdxSet { + IdxSetBuf { _pd: Default::default(), bits: vec![init; num_words], } @@ -97,22 +97,22 @@ impl IdxSet { } } -impl Deref for OwnIdxSet { +impl Deref for IdxSetBuf { type Target = IdxSet; fn deref(&self) -> &IdxSet { unsafe { IdxSet::from_slice(&self.bits[..]) } } } -impl DerefMut for OwnIdxSet { +impl DerefMut for IdxSetBuf { fn deref_mut(&mut self) -> &mut IdxSet { unsafe { IdxSet::from_slice_mut(&mut self.bits[..]) } } } impl IdxSet { - pub fn to_owned(&self) -> OwnIdxSet { - OwnIdxSet { + pub fn to_owned(&self) -> IdxSetBuf { + IdxSetBuf { _pd: Default::default(), bits: self.bits.to_owned(), }