Skip to content

[WIP] Preliminary work splitting const qualification into separate passes #52518

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 10 commits into from
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