Skip to content

Commit 0e48112

Browse files
committed
Auto merge of rust-lang#68828 - oli-obk:inline_cycle, r=wesleywiser
Prevent query cycles in the MIR inliner r? `@eddyb` `@wesleywiser` cc `@rust-lang/wg-mir-opt` The general design is that we have a new query that is run on the `validated_mir` instead of on the `optimized_mir`. That query is forced before going into the optimization pipeline, so as to not try to read from a stolen MIR. The query should not be cached cross crate, as you should never call it for items from other crates. By its very design calls into other crates can never cause query cycles. This is a pessimistic approach to inlining, since we strictly have more calls in the `validated_mir` than we have in `optimized_mir`, but that's not a problem imo.
2 parents 589b1fe + d933b2f commit 0e48112

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

core/src/iter/range.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,7 @@ macro_rules! step_identical_methods {
200200
}
201201

202202
#[inline]
203+
#[allow(arithmetic_overflow)]
203204
fn forward(start: Self, n: usize) -> Self {
204205
// In debug builds, trigger a panic on overflow.
205206
// This should optimize completely out in release builds.
@@ -211,6 +212,7 @@ macro_rules! step_identical_methods {
211212
}
212213

213214
#[inline]
215+
#[allow(arithmetic_overflow)]
214216
fn backward(start: Self, n: usize) -> Self {
215217
// In debug builds, trigger a panic on overflow.
216218
// This should optimize completely out in release builds.

0 commit comments

Comments
 (0)