Use ScalarInt from bool.
This commit is contained in:
parent
0f9b7893d7
commit
a601e76857
2 changed files with 4 additions and 8 deletions
|
|
@ -8,10 +8,10 @@ use rustc_ast::InlineAsmOptions;
|
|||
use rustc_codegen_ssa::base::is_call_from_compiler_builtins_to_upstream_monomorphization;
|
||||
use rustc_data_structures::profiling::SelfProfilerRef;
|
||||
use rustc_index::IndexVec;
|
||||
use rustc_middle::ty::TypeVisitableExt;
|
||||
use rustc_middle::ty::adjustment::PointerCoercion;
|
||||
use rustc_middle::ty::layout::FnAbiOf;
|
||||
use rustc_middle::ty::print::with_no_trimmed_paths;
|
||||
use rustc_middle::ty::{ScalarInt, TypeVisitableExt};
|
||||
use rustc_session::config::OutputFilenames;
|
||||
use rustc_span::Symbol;
|
||||
|
||||
|
|
@ -1040,10 +1040,9 @@ pub(crate) fn codegen_operand<'tcx>(
|
|||
}
|
||||
Operand::Constant(const_) => crate::constant::codegen_constant_operand(fx, const_),
|
||||
Operand::RuntimeChecks(checks) => {
|
||||
let int = checks.value(fx.tcx.sess);
|
||||
let int = ScalarInt::try_from_uint(int, Size::from_bits(1)).unwrap();
|
||||
let val = checks.value(fx.tcx.sess);
|
||||
let layout = fx.layout_of(fx.tcx.types.bool);
|
||||
return CValue::const_val(fx, layout, int);
|
||||
return CValue::const_val(fx, layout, val.into());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -540,10 +540,7 @@ pub(crate) fn mir_operand_get_const_val<'tcx>(
|
|||
operand: &Operand<'tcx>,
|
||||
) -> Option<ScalarInt> {
|
||||
match operand {
|
||||
Operand::RuntimeChecks(checks) => {
|
||||
let int = checks.value(fx.tcx.sess);
|
||||
ScalarInt::try_from_uint(int, Size::from_bits(1))
|
||||
}
|
||||
Operand::RuntimeChecks(checks) => Some(checks.value(fx.tcx.sess).into()),
|
||||
Operand::Constant(const_) => eval_mir_constant(fx, const_).0.try_to_scalar_int(),
|
||||
// FIXME(rust-lang/rust#85105): Casts like `IMM8 as u32` result in the const being stored
|
||||
// inside a temporary before being passed to the intrinsic requiring the const argument.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue