1
Fork 0

Auto merge of #95976 - b-naber:valtree-constval-conversion, r=oli-obk

Implement Valtree to ConstValue conversion

Once we start to use `ValTree`s in the type system we will need to be able to convert them into `ConstValue` instances, which we want to continue to use after MIR construction.

r? `@oli-obk`

cc `@RalfJung`
This commit is contained in:
bors 2022-04-28 13:18:22 +00:00
commit b2c2a32870
15 changed files with 667 additions and 162 deletions

View file

@ -936,6 +936,11 @@ rustc_queries! {
remap_env_constness
}
/// Converts a type level constant value into `ConstValue`
query valtree_to_const_val(key: (Ty<'tcx>, ty::ValTree<'tcx>)) -> ConstValue<'tcx> {
desc { "convert type-level constant value to mir constant value"}
}
/// Destructure a constant ADT or array into its variant index and its
/// field values or return `None` if constant is invalid.
///