account for custom DSTs in valtree -> constvalue conversion

This commit is contained in:
b-naber
2022-04-26 10:58:45 +02:00
parent 6fc3e630fb
commit bfefb4d74c
3 changed files with 123 additions and 9 deletions

View File

@@ -215,6 +215,10 @@ fn turn_into_const_value<'tcx>(
"the `eval_to_const_value_raw` query should not be used for statics, use `eval_to_allocation` instead"
);
// Turn this into a proper constant.
let const_val = op_to_const(&ecx, &mplace.into());
debug!(?const_val);
if cfg!(debug_assertions) {
if let Some(valtree) = const_to_valtree(tcx, key.param_env, constant) {
let const_val = tcx.valtree_to_const_val((constant.ty, valtree));
@@ -222,10 +226,6 @@ fn turn_into_const_value<'tcx>(
}
}
// Turn this into a proper constant.
let const_val = op_to_const(&ecx, &mplace.into());
debug!(?const_val);
const_val
}