Skip to content

Commit fd90910

Browse files
authored
Rollup merge of rust-lang#125240 - lnicola:rustc-abi-nonzerousize, r=fee1-dead
Temporarily revert to NonZeroUsize in rustc-abi to fix building on stable rust-analyzer uses an auto-published version of `rustc-abi`, but `NonZero` isn't yet stable. This prevents us from updating the RA subtree, which is quite old already. I can file a revert PR after the release.
2 parents e4e7568 + 8ec5a3d commit fd90910

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

compiler/rustc_abi/src/layout.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ use std::borrow::{Borrow, Cow};
22
use std::cmp;
33
use std::fmt::{self, Write};
44
use std::iter;
5-
use std::num::NonZero;
65
use std::ops::Bound;
76
use std::ops::Deref;
87

@@ -11,8 +10,8 @@ use tracing::debug;
1110

1211
use crate::{
1312
Abi, AbiAndPrefAlign, Align, FieldsShape, IndexSlice, IndexVec, Integer, LayoutS, Niche,
14-
Primitive, ReprOptions, Scalar, Size, StructKind, TagEncoding, TargetDataLayout, Variants,
15-
WrappingRange,
13+
NonZeroUsize, Primitive, ReprOptions, Scalar, Size, StructKind, TagEncoding, TargetDataLayout,
14+
Variants, WrappingRange,
1615
};
1716

1817
// A variant is absent if it's uninhabited and only has ZST fields.
@@ -328,7 +327,7 @@ pub trait LayoutCalculator {
328327

329328
Some(LayoutS {
330329
variants: Variants::Single { index: VariantIdx::new(0) },
331-
fields: FieldsShape::Union(NonZero::new(only_variant.len())?),
330+
fields: FieldsShape::Union(NonZeroUsize::new(only_variant.len())?),
332331
abi,
333332
largest_niche: None,
334333
align,

compiler/rustc_abi/src/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#![cfg_attr(feature = "nightly", feature(rustdoc_internals))]
55

66
use std::fmt;
7-
use std::num::{NonZero, ParseIntError};
7+
use std::num::{NonZeroUsize, ParseIntError};
88
use std::ops::{Add, AddAssign, Mul, RangeInclusive, Sub};
99
use std::str::FromStr;
1010

@@ -1175,7 +1175,7 @@ pub enum FieldsShape<FieldIdx: Idx> {
11751175
Primitive,
11761176

11771177
/// All fields start at no offset. The `usize` is the field count.
1178-
Union(NonZero<usize>),
1178+
Union(NonZeroUsize),
11791179

11801180
/// Array/vector-like placement, with all fields of identical types.
11811181
Array { stride: Size, count: u64 },

0 commit comments

Comments
 (0)