do not emit OpaqueCast projections with -Znext-solver#139902
Merged
Conversation
Collaborator
|
Some changes occurred to MIR optimizations cc @rust-lang/wg-mir-opt This PR changes MIR cc @oli-obk, @RalfJung, @JakobDegen, @davidtwco, @vakaras Some changes occurred in match lowering cc @Nadrieril |
lcnr
commented
Apr 16, 2025
| // hidden types, so we don't need these projections anymore. | ||
| // | ||
| // Performance optimization: don't reintern if there is no `OpaqueCast` to remove. | ||
| if place.projection.iter().any(|elem| matches!(elem, ProjectionElem::OpaqueCast(_))) { |
Contributor
Author
There was a problem hiding this comment.
this also affects the old solver as we now continue to super_visit even if there are no opaque casts involved.
I think this is more correct as we want to normalize types and consts regardless of whether a projection contained an opaque.
oli-obk
approved these changes
Apr 16, 2025
Contributor
|
Do we have tests that actually excercise this in the old solver where the tests are also run with the new solver? |
5200c77 to
111cabc
Compare
Contributor
Author
|
enabled two tests which started to fail with the old solver @bors r=oli-obk rollup |
Collaborator
111cabc to
c85b5fc
Compare
Contributor
Author
|
@bors r=oli-obk rollup |
Collaborator
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this pull request
Apr 17, 2025
…oli-obk do not emit `OpaqueCast` projections with `-Znext-solver` We normalize opaque types in their defining scope if the new solver is enabled. This means projections do not contain any 'revealable' opaque types we need to worry about. We either have a type which has been normalized by writeback or we need to normalize it anyways. r? `@compiler-errors` `@oli-obk`
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this pull request
Apr 17, 2025
…oli-obk do not emit `OpaqueCast` projections with `-Znext-solver` We normalize opaque types in their defining scope if the new solver is enabled. This means projections do not contain any 'revealable' opaque types we need to worry about. We either have a type which has been normalized by writeback or we need to normalize it anyways. r? ``@compiler-errors`` ``@oli-obk``
This was referenced Apr 17, 2025
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Apr 17, 2025
…iaskrgr Rollup of 9 pull requests Successful merges: - rust-lang#139774 (Fix replacing supertrait aliases in `ReplaceProjectionWith`) - rust-lang#139850 (Hide unstable print kinds within emit_unknown_print_request_help in stable channel) - rust-lang#139870 (add retries to remove and create dir all) - rust-lang#139902 (do not emit `OpaqueCast` projections with `-Znext-solver`) - rust-lang#139931 (bootstrap: enable zlib for LLVM for Windows GNU) - rust-lang#139935 (Upgrade to `rustc-rayon-core` 0.5.1) - rust-lang#139943 (rustdoc: Support inlined cross-crate re-exported trait aliases) - rust-lang#139961 (Two `rustc_const_eval` cleanups) - rust-lang#139962 (opt-dist: add a flag for running tests) r? `@ghost` `@rustbot` modify labels: rollup
rust-timer
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Apr 17, 2025
Rollup merge of rust-lang#139902 - lcnr:no-opaque-cast-projection, r=oli-obk do not emit `OpaqueCast` projections with `-Znext-solver` We normalize opaque types in their defining scope if the new solver is enabled. This means projections do not contain any 'revealable' opaque types we need to worry about. We either have a type which has been normalized by writeback or we need to normalize it anyways. r? ```@compiler-errors``` ```@oli-obk```
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.
We normalize opaque types in their defining scope if the new solver is enabled. This means projections do not contain any 'revealable' opaque types we need to worry about. We either have a type which has been normalized by writeback or we need to normalize it anyways.
r? @compiler-errors @oli-obk