1
Fork 0

deduplicate constant evaluation in cranelift backend

also sync LLVM and cranelift structure a bit
This commit is contained in:
Ralf Jung 2022-11-19 13:41:21 +01:00
parent becc24a23a
commit 3338244f69
3 changed files with 31 additions and 51 deletions

View file

@ -42,7 +42,14 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
};
self.cx.tcx().const_eval_resolve(ty::ParamEnv::reveal_all(), uv, None).map_err(|err| {
self.cx.tcx().sess.span_err(constant.span, "erroneous constant encountered");
match err {
ErrorHandled::Reported(_) => {
self.cx.tcx().sess.span_err(constant.span, "erroneous constant encountered");
}
ErrorHandled::TooGeneric => {
span_bug!(constant.span, "codegen encountered polymorphic constant: {:?}", err);
}
}
err
})
}