-
Notifications
You must be signed in to change notification settings - Fork 13.9k
Description
We want to remove calls to ty::Const::{normalize,eval,eval_to_*} because they won't work correctly with future reformulations of GCE, and because they're unnecessary with non-GCE consts. This issue tracks doing that so I won't forget. Boxy can probably write more motivation here idk
Boxy rationale:
with
min_generic_const_argsandassociated_const_equalityfeatuers normalization of type system constants will be behaving much more like types. They'll return nested goals, access in scope whjere clauses such asT: Trait<ASSOC = 10>in order to normalize instead of simply "evaluating".This means that the only correct way to normalize a
ty::Constwill be to use the "normal" normalization routines such asnormalize_erasing_regionsorinfcx/ocx/fcx.normalize. With that in mind all of theeval_xandnormalizemethods onty::Constbecome massive footguns as they are never correct to use.
- Remove eval calls from codegen (Only expect valtree consts in codegen #130644)
- Replace calls to
eval_bitswithtry_to_bits, which I forgot in codegen lol
- Replace calls to
- Normalize writeback results (Normalize consts in writeback when GCE is enabled #130645)
- Replace calls to
evalfrommir_buildandpattern_analysisin now that writeback results are normalized (Replace calls toty::Const::{try_}evalin mir build/pattern analysis #130715)
- Replace calls to
- Add
structurally_resolve_constfor use inFnCtxt/hir_typeck(Introducestructurally_normalize_const, use it inrustc_hir_typeck#130714)- Replace calls to
eval_*withstructurally_resolve+try_to_*in hir typeck
- Replace calls to
- Audit remaining calls to
eva;/normalizepost-borrowck, replacing them with theirtry_to_*variants + possibly normalizing depending on the source of the const.
More:
cc @BoxyUwU