Skip to content

Commit 199ff02

Browse files
committed
resolving conflicts
1 parent 82410e8 commit 199ff02

File tree

4 files changed

+24
-33
lines changed

4 files changed

+24
-33
lines changed

src/librustc/ty/layout.rs

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use std::iter;
1212
use std::mem;
1313
use std::ops::Bound;
1414

15-
use hir;
15+
use crate::hir;
1616
use crate::ich::StableHashingContext;
1717
use rustc_data_structures::indexed_vec::{IndexVec, Idx};
1818
use rustc_data_structures::stable_hasher::{HashStable, StableHasher,
@@ -1892,25 +1892,27 @@ impl<'a, 'tcx, C> TyLayoutMethods<'tcx, C> for Ty<'tcx>
18921892

18931893
_ => {
18941894
let mut data_variant = match this.variants {
1895-
Variants::NicheFilling { dataful_variant, .. } => {
1896-
// Only the niche in this is always initialized,
1897-
// so only check for a pointer at its offset.
1898-
//
1899-
// If the niche is a pointer, it's either valid
1900-
// (according to its type), or null (which the
1901-
// niche field's scalar validity range encodes).
1902-
// This allows using `dereferenceable_or_null`
1903-
// for e.g., `Option<&T>`, and this will continue
1904-
// to work as long as we don't start using more
1905-
// niches than just null (e.g., the first page
1906-
// of the address space, or unaligned pointers).
1907-
if this.fields.offset(0) == offset {
1908-
Some(this.for_variant(cx, dataful_variant))
1909-
} else {
1910-
None
1911-
}
1912-
}
1913-
_ => Some(this)
1895+
// Within the discriminant field, only the niche itself is
1896+
// always initialized, so we only check for a pointer at its
1897+
// offset.
1898+
//
1899+
// If the niche is a pointer, it's either valid (according
1900+
// to its type), or null (which the niche field's scalar
1901+
// validity range encodes). This allows using
1902+
// `dereferenceable_or_null` for e.g., `Option<&T>`, and
1903+
// this will continue to work as long as we don't start
1904+
// using more niches than just null (e.g., the first page of
1905+
// the address space, or unaligned pointers).
1906+
Variants::Multiple {
1907+
discr_kind: DiscriminantKind::Niche {
1908+
dataful_variant,
1909+
..
1910+
},
1911+
discr_index,
1912+
..
1913+
} if this.fields.offset(discr_index) == offset =>
1914+
Some(this.for_variant(cx, dataful_variant)),
1915+
_ => Some(this),
19141916
};
19151917

19161918
if let Some(variant) = data_variant {
@@ -1931,9 +1933,8 @@ impl<'a, 'tcx, C> TyLayoutMethods<'tcx, C> for Ty<'tcx>
19311933
result = field.ok()
19321934
.and_then(|field| {
19331935
if ptr_end <= field_start + field.size {
1934-
let off = offset - field_start;
19351936
// We found the right field, look inside it.
1936-
Self::pointee_info_at(field, cx, off, param_env)
1937+
field.pointee_info_at(cx, offset - field_start, param_env)
19371938
} else {
19381939
None
19391940
}

src/librustc_codegen_llvm/abi.rs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,11 @@ use crate::llvm::{self, AttributePlace};
22
use crate::builder::Builder;
33
use crate::context::CodegenCx;
44
use crate::type_::Type;
5-
use crate::type_of::{LayoutLlvmExt, PointerKind};
65
use crate::value::Value;
6+
use crate::type_of::{LayoutLlvmExt};
77
use rustc_codegen_ssa::MemFlags;
88
use rustc_codegen_ssa::mir::place::PlaceRef;
99
use rustc_codegen_ssa::mir::operand::OperandValue;
10-
<<<<<<< HEAD
11-
=======
12-
use type_::Type;
13-
use type_of::{LayoutLlvmExt};
14-
use value::Value;
15-
>>>>>>> Remove old pointee_info_at body.
1610
use rustc_target::abi::call::ArgType;
1711

1812
use rustc_codegen_ssa::traits::*;

src/librustc_codegen_llvm/context.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ use rustc::hir;
88

99
use crate::monomorphize::partitioning::CodegenUnit;
1010
use crate::type_::Type;
11-
use crate::type_of::PointeeInfo;
1211
use rustc_codegen_ssa::traits::*;
1312

1413
use rustc_data_structures::base_n;

src/librustc_codegen_llvm/type_of.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
use crate::abi::{FnType, FnTypeExt};
22
use crate::common::*;
33
use crate::type_::Type;
4-
use rustc::hir;
5-
use abi::{FnType, FnTypeExt};
6-
use common::*;
74
use rustc::ty::{self, Ty, TypeFoldable};
85
use rustc::ty::layout::{self, Align, LayoutOf, PointeeInfo, Size, TyLayout};
96
use rustc_target::abi::{FloatTy, TyLayoutMethods};

0 commit comments

Comments
 (0)