Skip to content
Closed
10 changes: 10 additions & 0 deletions src/librustc_data_structures/indexed_set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,16 @@ impl<T: Idx> IdxSet<T> {
self.bits.set_bit(elem.index())
}

/// Adds `elem` to the set `self` if `member` is `true`, otherwise removes `elem` from the set;
/// returns true iff this changed `self`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you need this? Alternatively, you have BitVector (yes, we ended up with 2 APIs for the same purpose).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, it's used. I don't see how it's immediately similar to BitVector...

pub fn set_member(&mut self, elem: &T, member: bool) -> bool {
if member {
self.add(elem)
} else {
self.remove(elem)
}
}

pub fn range(&self, elems: &Range<T>) -> &Self {
let elems = elems.start.index()..elems.end.index();
unsafe { Self::from_slice(&self.bits[elems]) }
Expand Down
6 changes: 3 additions & 3 deletions src/librustc_mir/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,14 @@ Rust MIR: a lowered representation of Rust. Also: an experiment!
extern crate arena;

#[macro_use]
extern crate bitflags;
#[macro_use] extern crate log;
extern crate log;
extern crate either;
extern crate graphviz as dot;
extern crate polonius_engine;
#[macro_use]
extern crate rustc;
#[macro_use] extern crate rustc_data_structures;
#[macro_use]
extern crate rustc_data_structures;
extern crate serialize as rustc_serialize;
extern crate rustc_errors;
#[macro_use]
Expand Down
5 changes: 2 additions & 3 deletions src/librustc_mir/transform/promote_consts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -384,9 +384,8 @@ impl<'a, 'tcx> MutVisitor<'tcx> for Promoter<'a, 'tcx> {
local: &mut Local,
_: PlaceContext<'tcx>,
_: Location) {
if self.source.local_kind(*local) == LocalKind::Temp {
*local = self.promote_temp(*local);
}
assert_eq!(self.source.local_kind(*local), LocalKind::Temp);
*local = self.promote_temp(*local);
}
}

Expand Down
Loading