Skip to content

Commit 926002a

Browse files
committed
Name some local variables more consistently.
By making every `alt_foo` exactly match a `foo`.
1 parent 11053d8 commit 926002a

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

compiler/rustc_abi/src/layout.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -65,20 +65,20 @@ pub trait LayoutCalculator {
6565
if !matches!(kind, StructKind::MaybeUnsized) {
6666
if let Some(niche) = layout.largest_niche {
6767
let head_space = niche.offset.bytes();
68-
let niche_length = niche.value.size(dl).bytes();
69-
let tail_space = layout.size.bytes() - head_space - niche_length;
68+
let niche_len = niche.value.size(dl).bytes();
69+
let tail_space = layout.size.bytes() - head_space - niche_len;
7070

7171
// This may end up doing redundant work if the niche is already in the last
7272
// field (e.g. a trailing bool) and there is tail padding. But it's non-trivial
7373
// to get the unpadded size so we try anyway.
7474
if fields.len() > 1 && head_space != 0 && tail_space > 0 {
7575
let alt_layout = univariant(self, dl, fields, repr, kind, NicheBias::End)
7676
.expect("alt layout should always work");
77-
let niche = alt_layout
77+
let alt_niche = alt_layout
7878
.largest_niche
7979
.expect("alt layout should have a niche like the regular one");
80-
let alt_head_space = niche.offset.bytes();
81-
let alt_niche_len = niche.value.size(dl).bytes();
80+
let alt_head_space = alt_niche.offset.bytes();
81+
let alt_niche_len = alt_niche.value.size(dl).bytes();
8282
let alt_tail_space =
8383
alt_layout.size.bytes() - alt_head_space - alt_niche_len;
8484

@@ -93,7 +93,7 @@ pub trait LayoutCalculator {
9393
alt_layout: {}\n",
9494
layout.size.bytes(),
9595
head_space,
96-
niche_length,
96+
niche_len,
9797
tail_space,
9898
alt_head_space,
9999
alt_niche_len,

0 commit comments

Comments
 (0)