Use assert_usize
instead of unwrap_usize
in several places
This commit is contained in:
parent
c2b663c666
commit
21551359a5
2 changed files with 3 additions and 5 deletions
|
@ -342,9 +342,7 @@ fn fixed_vec_metadata(
|
||||||
let (size, align) = cx.size_and_align_of(array_or_slice_type);
|
let (size, align) = cx.size_and_align_of(array_or_slice_type);
|
||||||
|
|
||||||
let upper_bound = match array_or_slice_type.sty {
|
let upper_bound = match array_or_slice_type.sty {
|
||||||
ty::Array(_, len) => {
|
ty::Array(_, len) => len.unwrap_usize(cx.tcx) as c_longlong,
|
||||||
len.unwrap_usize(cx.tcx) as c_longlong
|
|
||||||
}
|
|
||||||
_ => -1
|
_ => -1
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -332,8 +332,8 @@ fn place_base_conflict<'a, 'gcx: 'tcx, 'tcx>(
|
||||||
},
|
},
|
||||||
(StaticKind::Promoted(promoted_1), StaticKind::Promoted(promoted_2)) => {
|
(StaticKind::Promoted(promoted_1), StaticKind::Promoted(promoted_2)) => {
|
||||||
if promoted_1 == promoted_2 {
|
if promoted_1 == promoted_2 {
|
||||||
if let ty::Array(_, size) = s1.ty.sty {
|
if let ty::Array(_, len) = s1.ty.sty {
|
||||||
if size.unwrap_usize(tcx) == 0 {
|
if let Some(0) = len.assert_usize(tcx) {
|
||||||
// Ignore conflicts with promoted [T; 0].
|
// Ignore conflicts with promoted [T; 0].
|
||||||
debug!("place_element_conflict: IGNORE-LEN-0-PROMOTED");
|
debug!("place_element_conflict: IGNORE-LEN-0-PROMOTED");
|
||||||
return Overlap::Disjoint;
|
return Overlap::Disjoint;
|
||||||
|
|
Loading…
Reference in a new issue