Use TypingMode throughout the compiler instead of ParamEnv#132460
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.
Hopefully the biggest single PR as part of rust-lang/types-team#128.
infcx.typing_envwhile defining opaque typesI don't know how'll be able to correctly handle opaque types when using something taking a
TypingEnvwhile defining opaque types. To correctly handle the opaques we need to be able to pass in the currentopaque_type_storageand return constraints, i.e. we need to use a proper canonical query. We should migrate all the queries used during HIR typeck and borrowck where this matters to proper canonical queries. This islayout_ofandReveal::AllWe convert the
ParamEnvtoReveal::Allright at the start of thelayout_ofquery, so I've changed callers oflayout_ofto already use a post analysisTypingEnvwhen encountering it.rust/compiler/rustc_ty_utils/src/layout.rs
Line 51 in ca87b53
Ty::is_[unpin|sized|whatever]I haven't migrated
fn is_item_rawto useTypingEnv, will do so in a followup PR, this should significantly reduce the amount oftyping_env.param_env. At some point there will probably be zero such uses as using the type system while ignoring thetyping_modeis incorrect.MirPhaseand phase-transitionsWhen inside of a MIR-body, we can mostly use its
MirPhaseto figure out the righttyping_mode. This does not work during phase transitions, most notably when transitioning fromAnalysistoRuntime:rust/compiler/rustc_mir_transform/src/lib.rs
Lines 606 to 625 in dae7ac1
All these passes still run with
MirPhase::Analysis, but we should only useReveal::Allonce we're run theRevealAllpass. This required me to manually construct the rightTypingEnvin all these passes. Given that it feels somewhat easy to accidentally miss this going forward, I would maybe like to changeBody::phaseto anOptionand replace it at the start of phase transitions. This then makes it clear that the MIR is currently in a weird state.r? @ghost