rustc_index: Add a ZERO
constant to index types
It is commonly used.
This commit is contained in:
parent
7a1a4565f2
commit
46fc398706
@ -1393,7 +1393,7 @@ fn llvm_add_sub<'tcx>(
|
|||||||
|
|
||||||
// c + carry -> c + first intermediate carry or borrow respectively
|
// c + carry -> c + first intermediate carry or borrow respectively
|
||||||
let int0 = crate::num::codegen_checked_int_binop(fx, bin_op, a, b);
|
let int0 = crate::num::codegen_checked_int_binop(fx, bin_op, a, b);
|
||||||
let c = int0.value_field(fx, FieldIdx::new(0));
|
let c = int0.value_field(fx, FieldIdx::ZERO);
|
||||||
let cb0 = int0.value_field(fx, FieldIdx::new(1)).load_scalar(fx);
|
let cb0 = int0.value_field(fx, FieldIdx::new(1)).load_scalar(fx);
|
||||||
|
|
||||||
// c + carry -> c + second intermediate carry or borrow respectively
|
// c + carry -> c + second intermediate carry or borrow respectively
|
||||||
|
@ -61,7 +61,7 @@ pub(crate) fn get_ptr_and_method_ref<'tcx>(
|
|||||||
if ty.is_dyn_star() {
|
if ty.is_dyn_star() {
|
||||||
let inner_layout = fx.layout_of(arg.layout().ty.builtin_deref(true).unwrap().ty);
|
let inner_layout = fx.layout_of(arg.layout().ty.builtin_deref(true).unwrap().ty);
|
||||||
let dyn_star = CPlace::for_ptr(Pointer::new(arg.load_scalar(fx)), inner_layout);
|
let dyn_star = CPlace::for_ptr(Pointer::new(arg.load_scalar(fx)), inner_layout);
|
||||||
let ptr = dyn_star.place_field(fx, FieldIdx::new(0)).to_ptr();
|
let ptr = dyn_star.place_field(fx, FieldIdx::ZERO).to_ptr();
|
||||||
let vtable =
|
let vtable =
|
||||||
dyn_star.place_field(fx, FieldIdx::new(1)).to_cvalue(fx).load_scalar(fx);
|
dyn_star.place_field(fx, FieldIdx::new(1)).to_cvalue(fx).load_scalar(fx);
|
||||||
break 'block (ptr, vtable);
|
break 'block (ptr, vtable);
|
||||||
|
Loading…
Reference in New Issue
Block a user