Skip to content

Commit 3d650bd

Browse files
committed
Update mir_const_qualif
1 parent a135b4c commit 3d650bd

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
@@ -19,6 +19,7 @@ macro_rules! arena_types {
1919
[few] crate_inherent_impls: rustc::ty::CrateInherentImpls,
2020
[] region_scope_tree: rustc::middle::region::ScopeTree,
2121
[] item_local_set: rustc::util::nodemap::ItemLocalSet,
22+
[decode] mir_const_qualif: rustc_data_structures::bit_set::BitSet<rustc::mir::Local>,
2223
], $tcx);
2324
)
2425
}

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 => { cdata.get_inherent_implementations_for_type(tcx, 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;
@@ -831,7 +830,7 @@ impl<'a, 'tcx> Checker<'a, 'tcx> {
831830
}
832831

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

837836
let mir = self.mir;
@@ -905,8 +904,6 @@ impl<'a, 'tcx> Checker<'a, 'tcx> {
905904
}
906905
}
907906

908-
let promoted_temps = Lrc::new(promoted_temps);
909-
910907
let mut qualifs = self.qualifs_in_local(RETURN_PLACE);
911908

912909
// Account for errors in consts by using the
@@ -915,7 +912,7 @@ impl<'a, 'tcx> Checker<'a, 'tcx> {
915912
qualifs = self.qualifs_in_any_value_of_ty(mir.return_ty());
916913
}
917914

918-
(qualifs.encode_to_bits(), promoted_temps)
915+
(qualifs.encode_to_bits(), self.tcx.arena.alloc(promoted_temps))
919916
}
920917
}
921918

@@ -1435,7 +1432,7 @@ pub fn provide(providers: &mut Providers<'_>) {
14351432

14361433
fn mir_const_qualif<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
14371434
def_id: DefId)
1438-
-> (u8, Lrc<BitSet<Local>>) {
1435+
-> (u8, &'tcx BitSet<Local>) {
14391436
// N.B., this `borrow()` is guaranteed to be valid (i.e., the value
14401437
// cannot yet be stolen), because `mir_validated()`, which steals
14411438
// from `mir_const(), forces this query to execute before
@@ -1444,7 +1441,7 @@ fn mir_const_qualif<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
14441441

14451442
if mir.return_ty().references_error() {
14461443
tcx.sess.delay_span_bug(mir.span, "mir_const_qualif: Mir had errors");
1447-
return (1 << IsNotConst::IDX, Lrc::new(BitSet::new_empty(0)));
1444+
return (1 << IsNotConst::IDX, tcx.arena.alloc(BitSet::new_empty(0)));
14481445
}
14491446

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

0 commit comments

Comments
 (0)