Skip to content

Commit 1fe0d4e

Browse files
committed
Update mir_const_qualif
1 parent d56d2fb commit 1fe0d4e

File tree

4 files changed

+7
-9
lines changed

4 files changed

+7
-9
lines changed

src/librustc/arena.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ macro_rules! arena_types {
1818
[decode] specialization_graph: rustc::traits::specialization_graph::Graph,
1919
[] region_scope_tree: rustc::middle::region::ScopeTree,
2020
[] item_local_set: rustc::util::nodemap::ItemLocalSet,
21+
[decode] mir_const_qualif: rustc_data_structures::bit_set::BitSet<rustc::mir::Local>,
2122
], $tcx);
2223
)
2324
}

src/librustc/query/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ rustc_queries! {
9191
/// Maps DefId's that have an associated Mir to the result
9292
/// of the MIR qualify_consts pass. The actual meaning of
9393
/// the value isn't known except to the pass itself.
94-
query mir_const_qualif(key: DefId) -> (u8, Lrc<BitSet<mir::Local>>) {
94+
query mir_const_qualif(key: DefId) -> (u8, &'tcx BitSet<mir::Local>) {
9595
cache { key.is_local() }
9696
}
9797

src/librustc_metadata/cstore_impl.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ provide! { <'tcx> tcx, def_id, other, cdata,
131131
mir
132132
}
133133
mir_const_qualif => {
134-
(cdata.mir_const_qualif(def_id.index), Lrc::new(BitSet::new_empty(0)))
134+
(cdata.mir_const_qualif(def_id.index), tcx.arena.alloc(BitSet::new_empty(0)))
135135
}
136136
fn_sig => { cdata.fn_sig(def_id.index, tcx) }
137137
inherent_impls => { Lrc::new(cdata.get_inherent_implementations_for_type(def_id.index)) }

src/librustc_mir/transform/qualify_consts.rs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
use rustc_data_structures::bit_set::BitSet;
88
use rustc_data_structures::indexed_vec::IndexVec;
99
use rustc_data_structures::fx::FxHashSet;
10-
use rustc_data_structures::sync::Lrc;
1110
use rustc_target::spec::abi::Abi;
1211
use rustc::hir;
1312
use rustc::hir::def_id::DefId;
@@ -833,7 +832,7 @@ impl<'a, 'tcx> Checker<'a, 'tcx> {
833832
}
834833

835834
/// Check a whole const, static initializer or const fn.
836-
fn check_const(&mut self) -> (u8, Lrc<BitSet<Local>>) {
835+
fn check_const(&mut self) -> (u8, &'tcx BitSet<Local>) {
837836
debug!("const-checking {} {:?}", self.mode, self.def_id);
838837

839838
let mir = self.mir;
@@ -907,8 +906,6 @@ impl<'a, 'tcx> Checker<'a, 'tcx> {
907906
}
908907
}
909908

910-
let promoted_temps = Lrc::new(promoted_temps);
911-
912909
let mut qualifs = self.qualifs_in_local(RETURN_PLACE);
913910

914911
// Account for errors in consts by using the
@@ -917,7 +914,7 @@ impl<'a, 'tcx> Checker<'a, 'tcx> {
917914
qualifs = self.qualifs_in_any_value_of_ty(mir.return_ty());
918915
}
919916

920-
(qualifs.encode_to_bits(), promoted_temps)
917+
(qualifs.encode_to_bits(), self.tcx.arena.alloc(promoted_temps))
921918
}
922919
}
923920

@@ -1433,7 +1430,7 @@ pub fn provide(providers: &mut Providers<'_>) {
14331430

14341431
fn mir_const_qualif<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
14351432
def_id: DefId)
1436-
-> (u8, Lrc<BitSet<Local>>) {
1433+
-> (u8, &'tcx BitSet<Local>) {
14371434
// N.B., this `borrow()` is guaranteed to be valid (i.e., the value
14381435
// cannot yet be stolen), because `mir_validated()`, which steals
14391436
// from `mir_const(), forces this query to execute before
@@ -1442,7 +1439,7 @@ fn mir_const_qualif<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
14421439

14431440
if mir.return_ty().references_error() {
14441441
tcx.sess.delay_span_bug(mir.span, "mir_const_qualif: Mir had errors");
1445-
return (1 << IsNotPromotable::IDX, Lrc::new(BitSet::new_empty(0)));
1442+
return (1 << IsNotPromotable::IDX, tcx.arena.alloc(BitSet::new_empty(0)));
14461443
}
14471444

14481445
Checker::new(tcx, def_id, mir, Mode::Const).check_const()

0 commit comments

Comments
 (0)