Skip to content

Commit 6728f2f

Browse files
authored
Rollup merge of #123419 - petrochenkov:zeroindex, r=compiler-errors
rustc_index: Add a `ZERO` constant to index types It is commonly used.
2 parents b0710dc + 46fc398 commit 6728f2f

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/intrinsics/llvm_x86.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1393,7 +1393,7 @@ fn llvm_add_sub<'tcx>(
13931393

13941394
// c + carry -> c + first intermediate carry or borrow respectively
13951395
let int0 = crate::num::codegen_checked_int_binop(fx, bin_op, a, b);
1396-
let c = int0.value_field(fx, FieldIdx::new(0));
1396+
let c = int0.value_field(fx, FieldIdx::ZERO);
13971397
let cb0 = int0.value_field(fx, FieldIdx::new(1)).load_scalar(fx);
13981398

13991399
// c + carry -> c + second intermediate carry or borrow respectively

src/vtable.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ pub(crate) fn get_ptr_and_method_ref<'tcx>(
6161
if ty.is_dyn_star() {
6262
let inner_layout = fx.layout_of(arg.layout().ty.builtin_deref(true).unwrap().ty);
6363
let dyn_star = CPlace::for_ptr(Pointer::new(arg.load_scalar(fx)), inner_layout);
64-
let ptr = dyn_star.place_field(fx, FieldIdx::new(0)).to_ptr();
64+
let ptr = dyn_star.place_field(fx, FieldIdx::ZERO).to_ptr();
6565
let vtable =
6666
dyn_star.place_field(fx, FieldIdx::new(1)).to_cvalue(fx).load_scalar(fx);
6767
break 'block (ptr, vtable);

0 commit comments

Comments
 (0)