rustc: remove useless 0 prefix from Layout::StructWrappedNullablePointer's discrfield.

This commit is contained in:
Eduard-Mihai Burtescu 2017-09-10 19:34:11 +03:00
parent 44eef7c9ac
commit 50a3fd0097
3 changed files with 1 additions and 5 deletions

View File

@ -1145,7 +1145,6 @@ pub enum Layout {
StructWrappedNullablePointer {
nndiscr: u64,
nonnull: Struct,
/// N.B. There is a 0 at the start, for LLVM GEP through a pointer.
discrfield: FieldPath,
/// Like discrfield, but in source order. For debuginfo.
discrfield_source: FieldPath
@ -1472,9 +1471,7 @@ impl<'a, 'tcx> Layout {
let mut i = *path.last().unwrap();
i = st.memory_index[i as usize];
*path.last_mut().unwrap() = i;
path.push(0); // For GEP through a pointer.
path.reverse();
path_source.push(0);
path_source.reverse();
return success(StructWrappedNullablePointer {

View File

@ -1312,7 +1312,6 @@ impl<'tcx> EnumMemberDescriptionFactory<'tcx> {
let null_variant_index = (1 - nndiscr) as usize;
let null_variant_name = adt.variants[null_variant_index].name;
let discrfield_source = discrfield_source.iter()
.skip(1)
.map(|x| x.to_string())
.collect::<Vec<_>>().join("$");
let union_member_name = format!("RUST$ENCODED$ENUM${}${}",

View File

@ -332,7 +332,7 @@ impl<'a, 'tcx> LvalueRef<'tcx> {
// Double index to account for padding (FieldPath already uses `Struct::memory_index`)
fn gepi_struct_llfields_path(self, bcx: &Builder, discrfield: &layout::FieldPath) -> ValueRef {
let path = iter::once(C_u32(bcx.ccx, 0)).chain(discrfield[1..].iter().map(|&i| {
let path = iter::once(C_u32(bcx.ccx, 0)).chain(discrfield.iter().map(|&i| {
let i = adt::memory_index_to_gep(i as u64);
assert_eq!(i as u32 as u64, i);
C_u32(bcx.ccx, i as u32)