-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
deref patterns: lower deref patterns to MIR #122598
Conversation
This comment was marked as resolved.
This comment was marked as resolved.
This comment has been minimized.
This comment has been minimized.
ebb769b
to
6c39107
Compare
This comment has been minimized.
This comment has been minimized.
6c39107
to
ee9ff2f
Compare
This comment has been minimized.
This comment has been minimized.
ee9ff2f
to
07e4549
Compare
cc @fee1-dead @BoxyUwU if you're curious |
This comment was marked as resolved.
This comment was marked as resolved.
07e4549
to
b1499a5
Compare
This comment has been minimized.
This comment has been minimized.
b1499a5
to
03d616b
Compare
This comment has been minimized.
This comment has been minimized.
03d616b
to
8a73cab
Compare
ab5b542
to
2e22b35
Compare
This is ready! @rustbot ready |
Some changes occurred to MIR optimizations cc @rust-lang/wg-mir-opt This PR changes MIR cc @oli-obk, @RalfJung, @JakobDegen, @davidtwco, @celinval, @vakaras This PR changes Stable MIR |
The only sensible solution I found to solve the fake borrows issue is to add non-shallow fake borrows to MIR and use that. That's a nontrivial change though. |
aa4fce2
to
91751db
Compare
91751db
to
16793d6
Compare
☔ The latest upstream changes (presumably #123991) made this pull request unmergeable. Please resolve the merge conflicts. |
This handles using deref patterns to choose the correct match arm. This does not handle bindings or guards. Co-authored-by: Deadbeef <ent3rm4n@gmail.com>
16793d6
to
726fb55
Compare
@bors r+ |
Rollup of 7 pull requests Successful merges: - rust-lang#120929 (Wrap dyn type with parentheses in suggestion) - rust-lang#122591 (Suggest using type args directly instead of equality constraint) - rust-lang#122598 (deref patterns: lower deref patterns to MIR) - rust-lang#123048 (alloc::Layout: explicitly document size invariant on the type level) - rust-lang#123993 (Do `check_coroutine_obligations` once per typeck root) - rust-lang#124218 (Allow nesting subdiagnostics in #[derive(Subdiagnostic)]) - rust-lang#124285 (Mark ``@RUSTC_BUILTIN`` search path usage as unstable) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#122598 - Nadrieril:full-derefpats, r=matthewjasper deref patterns: lower deref patterns to MIR This lowers deref patterns to MIR. This is a bit tricky because this is the first kind of pattern that requires storing a value in a temporary. Thanks to rust-lang#123324 false edges are no longer a problem. The thing I'm not confident about is the handling of fake borrows. This PR ignores any fake borrows inside a deref pattern. We are guaranteed to at least fake borrow the place of the first pointer value, which could be enough, but I'm not certain.
This lowers deref patterns to MIR. This is a bit tricky because this is the first kind of pattern that requires storing a value in a temporary. Thanks to #123324 false edges are no longer a problem.
The thing I'm not confident about is the handling of fake borrows. This PR ignores any fake borrows inside a deref pattern. We are guaranteed to at least fake borrow the place of the first pointer value, which could be enough, but I'm not certain.