properly decrement available_depth on cycles and provisional cache hits - #163185
Merged
Merged
Conversation
sjwang05
force-pushed
the
depth-budget-fix
branch
from
September 23, 2026 00:09
7b5fae8 to
11328cf
Compare
Contributor
Author
and here is one such program whose result depends on the provisional cache! :D #![recursion_limit = "6"]
use std::marker::PhantomData;
// We need to decrement available_depth on provisional cache hits.
// e.g., in the following example:
// A: Send, avail = 6
// -> PhantomData<A>: Send, avail = 5
// -> A: Send, avail = 4
// -> B: Send, avail = 5
// -> C: Send, avail = 4
// -> PhantomData<A>: Send, provisional cache hit, avail = 4 if we don't decrement
struct A(PhantomData<A>, B);
struct B(C);
struct C(PhantomData<A>);
struct W<T>(T);
fn require<T: Send>() {}
fn main() {
require::<A>();
require::<W<W<W<W<A>>>>>();
}I've added both the cycle and provisional cache versions as uitests |
lcnr
reviewed
Sep 23, 2026
sjwang05
force-pushed
the
depth-budget-fix
branch
from
September 23, 2026 18:09
11328cf to
e9824e4
Compare
Contributor
|
@bors r+ rollup |
Contributor
jhpratt
added a commit
to jhpratt/rust
that referenced
this pull request
Sep 23, 2026
properly decrement available_depth on cycles and provisional cache hits cc https://rust-lang.zulipchat.com/#narrow/channel/364551-t-types.2Ftrait-system-refactor/topic/overflow.20fcw.20depends.20on.20cached.20results.20with.20cycles/with/625345435 With this change, the fuzzer doesn't seem to catch any mismatches or errors. If we decrement only on a cycle and not on a provisional cache hit, the fuzzer does report some mismatches. I decided to directly pass `available_depth` instead of using the `lower_available_depth` arg since `allowed_depth_for_nested` already computes `available_depth` based on `lower_available_depth`. r? lcnr
rust-bors Bot
pushed a commit
that referenced
this pull request
Sep 24, 2026
Rollup of 8 pull requests Successful merges: - #162976 (fix quadratic naming of duplicate sidebar links) - #163222 (Enable EII tests for cg_gcc) - #162942 (Remove `StashKey::AssociatedTypeSuggestion`) - #163096 (Don't suggest `std::` rustfix paths in `#![no_std]` crates) - #163110 (Mark `std::os::wasip2` with correct doc-cfgs, mark as unstable) - #163185 (properly decrement available_depth on cycles and provisional cache hits) - #163214 (revert r14 register names for arm) - #163226 (miri subtree update)
rust-bors Bot
pushed a commit
that referenced
this pull request
Sep 24, 2026
Rollup of 8 pull requests Successful merges: - #162976 (fix quadratic naming of duplicate sidebar links) - #163222 (Enable EII tests for cg_gcc) - #162942 (Remove `StashKey::AssociatedTypeSuggestion`) - #163096 (Don't suggest `std::` rustfix paths in `#![no_std]` crates) - #163110 (Mark `std::os::wasip2` with correct doc-cfgs, mark as unstable) - #163185 (properly decrement available_depth on cycles and provisional cache hits) - #163214 (revert r14 register names for arm) - #163226 (miri subtree update)
rust-bors Bot
pushed a commit
that referenced
this pull request
Sep 24, 2026
…uwer Rollup of 14 pull requests Successful merges: - #162976 (fix quadratic naming of duplicate sidebar links) - #161275 (Refactor `core::cmp::{smallest, largest}` & add `mir-opt` test) - #163143 (cg_llvm: Use fewer FFI calls to check the target CPU's features) - #163188 (Adjust for Arm64EC name mangling when checking for exported symbols) - #163211 (`rustc_builtin_macros` cleanup, part 6) - #161386 (Don't merge distinct impl candidates) - #162942 (Remove `StashKey::AssociatedTypeSuggestion`) - #163096 (Don't suggest `std::` rustfix paths in `#![no_std]` crates) - #163110 (Mark `std::os::wasip2` with correct doc-cfgs, mark as unstable) - #163185 (properly decrement available_depth on cycles and provisional cache hits) - #163214 (revert r14 register names for arm) - #163226 (miri subtree update) - #163228 (Add regression test for trait predicate with escaping bounds) - #163234 (`rustc_dump_symbol_name`: add demangling information as a note instead)
rust-bors Bot
pushed a commit
that referenced
this pull request
Sep 24, 2026
Rollup merge of #163185 - sjwang05:depth-budget-fix, r=lcnr properly decrement available_depth on cycles and provisional cache hits cc https://rust-lang.zulipchat.com/#narrow/channel/364551-t-types.2Ftrait-system-refactor/topic/overflow.20fcw.20depends.20on.20cached.20results.20with.20cycles/with/625345435 With this change, the fuzzer doesn't seem to catch any mismatches or errors. If we decrement only on a cycle and not on a provisional cache hit, the fuzzer does report some mismatches. I decided to directly pass `available_depth` instead of using the `lower_available_depth` arg since `allowed_depth_for_nested` already computes `available_depth` based on `lower_available_depth`. r? lcnr
pull Bot
pushed a commit
to xtqqczze/rust-lang-miri
that referenced
this pull request
Sep 25, 2026
…uwer Rollup of 14 pull requests Successful merges: - rust-lang/rust#162976 (fix quadratic naming of duplicate sidebar links) - rust-lang/rust#161275 (Refactor `core::cmp::{smallest, largest}` & add `mir-opt` test) - rust-lang/rust#163143 (cg_llvm: Use fewer FFI calls to check the target CPU's features) - rust-lang/rust#163188 (Adjust for Arm64EC name mangling when checking for exported symbols) - rust-lang/rust#163211 (`rustc_builtin_macros` cleanup, part 6) - rust-lang/rust#161386 (Don't merge distinct impl candidates) - rust-lang/rust#162942 (Remove `StashKey::AssociatedTypeSuggestion`) - rust-lang/rust#163096 (Don't suggest `std::` rustfix paths in `#![no_std]` crates) - rust-lang/rust#163110 (Mark `std::os::wasip2` with correct doc-cfgs, mark as unstable) - rust-lang/rust#163185 (properly decrement available_depth on cycles and provisional cache hits) - rust-lang/rust#163214 (revert r14 register names for arm) - rust-lang/rust#163226 (miri subtree update) - rust-lang/rust#163228 (Add regression test for trait predicate with escaping bounds) - rust-lang/rust#163234 (`rustc_dump_symbol_name`: add demangling information as a note instead)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
cc https://rust-lang.zulipchat.com/#narrow/channel/364551-t-types.2Ftrait-system-refactor/topic/overflow.20fcw.20depends.20on.20cached.20results.20with.20cycles/with/625345435
With this change, the fuzzer doesn't seem to catch any mismatches or errors. If we decrement only on a cycle and not on a provisional cache hit, the fuzzer does report some mismatches.
I decided to directly pass
available_depthinstead of using thelower_available_deptharg sinceallowed_depth_for_nestedalready computesavailable_depthbased onlower_available_depth.r? lcnr