Skip to content

Commit b8e1a34

Browse files
Rollup merge of rust-lang#119252 - Enselic:rustc_mir_transform-query-stability, r=cjgillot
rustc_mir_transform: Enforce `rustc::potential_query_instability` lint Stop allowing `rustc::potential_query_instability` on all of rustc_mir_transform and instead allow it on a case-by-case basis if it is safe to do so. In this particular crate, all instances were safe to allow. Part of rust-lang#84447 which is E-help-wanted.
2 parents 78c988f + 6d8fb57 commit b8e1a34

File tree

3 files changed

+4
-1
lines changed

3 files changed

+4
-1
lines changed

compiler/rustc_mir_transform/src/const_prop_lint.rs

+2
Original file line numberDiff line numberDiff line change
@@ -670,6 +670,8 @@ impl<'tcx> Visitor<'tcx> for ConstPropagator<'_, 'tcx> {
670670
// This loop can get very hot for some bodies: it check each local in each bb.
671671
// To avoid this quadratic behaviour, we only clear the locals that were modified inside
672672
// the current block.
673+
// The order in which we remove consts does not matter.
674+
#[allow(rustc::potential_query_instability)]
673675
for local in written_only_inside_own_block_locals.drain() {
674676
debug_assert_eq!(
675677
self.ecx.machine.can_const_prop[local],

compiler/rustc_mir_transform/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#![allow(rustc::potential_query_instability)]
21
#![deny(rustc::untranslatable_diagnostic)]
32
#![deny(rustc::diagnostic_outside_of_impl)]
43
#![feature(box_patterns)]

compiler/rustc_mir_transform/src/unreachable_prop.rs

+2
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ impl MirPass<'_> for UnreachablePropagation {
5454
patch.apply(body);
5555

5656
// We do want do keep some unreachable blocks, but make them empty.
57+
// The order in which we clear bb statements does not matter.
58+
#[allow(rustc::potential_query_instability)]
5759
for bb in unreachable_blocks {
5860
body.basic_blocks_mut()[bb].statements.clear();
5961
}

0 commit comments

Comments
 (0)