TypingMode
#128
Labels
final-comment-period
The FCP has started, most (if not all) team members are in agreement
major-change
A major change proposal
T-types
Add this label so rfcbot knows to poll the types team
to-announce
Announce this issue on triage meeting
Proposal
Some of our typing rules depend on the "mode" we're in. Most notably, whether we should force "unknowable" trait goals to be ambiguous during coherence and whether to define or reveal opaque types.
This is currently handled via
ParamEnv::reveal
,InferCtxt::intercrate
, andInferCtxt::defining_opaque_types
and never changes during the lifetime of aInferCtxt
. Going forward we intend to add yet another mode to the type system: only reveal opaques defined by some body, but without being able to define them. This is necessary during places such as opaque type well-formedness checking. We currentlyThis is the reason why we've needed rust-lang/rust#124598 for bootstrap with the new solver. We intend to fix this issue by adding an additional typing mode which allows revealing some opaque types without allowing any new definitions.
We currently also frequently accidentally forget parts of our typing mode, e.g. when calling nested queries which only take a
ParamEnvAnd
, dropping both thedefining_opaque_types
andintercrate
.I intend to change this by moving all of this information into a new
typing_mode
field on theInferCtxt
and then change queries currently taking aParamEnv
to instead take astruct TypingEnv<'tcx> { typing_mode: TypingMode<'tcx>, param_env: ty::ParamEnv<'tcx> }
.I've started to already implement this in rust-lang/rust#131856 and am continuing this work in rust-lang/rust#132460. Given that this is ending up being quite involved and a nightmare to revert, I want to make sure the full Types Team is aware of this effort.
See https://rust-lang.zulipchat.com/#narrow/channel/364551-t-types.2Ftrait-system-refactor/topic/.60TypingMode.60 for more details, might extend this MCP tomorrow, have to leave for today 😅
Mentors or Reviewers
@compiler-errors
Process
The main points of the Major Change Process are as follows:
@rustbot second
.-C flag
, then full team check-off is required.@rfcbot fcp merge
on either the MCP or the PR.You can read more about Major Change Proposals on forge.
Comments
This issue is not meant to be used for technical discussion. There is a Zulip stream for that. Use this issue to leave procedural comments, such as volunteering to review, indicating that you second the proposal (or third, etc), or raising a concern that you would like to be addressed.
The text was updated successfully, but these errors were encountered: