Repository navigation
Conversation
A def whose signature does not mention its type parameters was checked once with every type parameter replaced by i32, and that result was reused for all instantiations. Bounds inherited from the parent impl or trait (impl<T: K>, the trait's Self: K) escaped the guard in placeholder_generic_args, which only looked at the def's own predicates, so the body was verified against i32's impl. Collect constrained type parameters including parent predicates, and defer such defs so they are analyzed per instantiation. Fixes #330 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013nBCcj2NXQuLQiJoxndHyP
RustCallVisitor turns the moved closure into an immutable borrow, but moved_locals had already removed its drop obligation, so the prophecies of the mutable borrows it captured were never resolved. Restore the obligation as the FnMut case already does. Fixes #331 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013nBCcj2NXQuLQiJoxndHyP
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
This branch has not been deployed
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.
This PR fixes two independent bugs, one per commit.
Analyze defs with trait-bounded type params per instantiation (fixes #330, unsound)
A def whose signature does not mention its type parameters was registered as concrete. Its body was checked once, with every type parameter replaced by
i32, and all instantiations reused that result. Two kinds of def are affected:impl<T: K> W<T>self-less trait default method, whereSelfis the bounded parameterThe guard in
placeholder_generic_argsonly looked at the def's own predicates, so bounds inherited from the parent impl or trait were missed.The fix adds
constrained_type_params, which collects bounds frompredicates_of(..).instantiate_identity(tcx), so parent predicates are included.refine_fn_defnow defers any def that has such a parameter, the same way it defers defs whose signature mentions a type parameter.placeholder_generic_argsreuses the helper.Drop an
Fnclosure called throughFnOnce::call_onceafter the call (fixes #331, incompleteness)RustCallVisitorcase 2 replaces the moved closure with an immutable borrow, butmoved_localshad already removed the closure's drop obligation. As a result, the&mutthe closure captured was never resolved. The fix restores the obligation withdrop_after_terminator, as case 3 already does.Tests
pass/failUI pairsgeneric_impl_static_method.rsandclosure_fn_once_fn_kind.rs.cargo test: all 398 UI tests pass, using the CI-pinned Z3 and PCSat.🤖 Generated with Claude Code
https://claude.ai/code/session_013nBCcj2NXQuLQiJoxndHyP
Generated by Claude Code