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_args
andassociated_const_equality
featuers 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::Const
will be to use the "normal" normalization routines such asnormalize_erasing_regions
orinfcx/ocx/fcx.normalize
. With that in mind all of theeval_x
andnormalize
methods onty::Const
become 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_bits
withtry_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
eval
frommir_build
andpattern_analysis
in now that writeback results are normalized (Replace calls toty::Const::{try_}eval
in mir build/pattern analysis #130715)
- Replace calls to
- Add
structurally_resolve_const
for 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;/normalize
post-borrowck, replacing them with theirtry_to_*
variants + possibly normalizing depending on the source of the const.
More:
cc @BoxyUwU