Merged
Conversation
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.
Shares the first commit with #138499, doesn't really matter which PR to land first 😊 😁
Introduces
TypingMode::Borrowckwhich unlikeTypingMode::Analysis, uses the hidden type computed by HIR typeck as the initial value of opaques instead of an unconstrained infer var. This is a part of rust-lang/types-team#129.Using this new
TypingModeis unfortunately a breaking change for now, see tests/ui/impl-trait/non-defining-uses/as-projection-term.rs. Using an inference variable as the initial value results in non-defining uses in the defining scope. We therefore only enable it if with-Znext-solver=globallyor-Ztyping-mode-borrowckTo do that the PR contains the following changes:
TypeckResults::concrete_opaque_typeare already mapped to the definition of the opaque typefn check_opaque_type_parameter_validis moved fromrustc_borrowcktorustc_trait_selectionquery type_of_opaque_hir_typeckwhich, using the same visitors as MIR typeck, attempts to merge the hidden types from HIR typeck from all defining scopesDefiningScopeKindflag to toggle between using borrowck and HIR typeckTypingMode::Borrowck, but adding it to the new structure is annoying and it's not soundness critical, so I intend to not add it back.TypingMode::Borrowckwhich behaves just likeTypingMode::Analysisexcept when normalizing opaque typestype_of_opaque_hir_typeck(opaque)as the initial value after replacing its regions with new inference varsfixes #112201, fixes #132335, fixes #137751
r? @compiler-errors @oli-obk