about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2024-05-18 18:44:15 +0200
committerGitHub <noreply@github.com>2024-05-18 18:44:15 +0200
commitfd90910f5f531ce33a483e765faf8ab497fcb990 (patch)
treea952754ff8ddc6713d22166057b1e5b50def5df7
parente4e75688c2aaedbd0b6e863d3cb1dfc5d914e330 (diff)
parent8ec5a3d7b44dc4ba0f5d55d401ac34e40fda84cb (diff)
downloadrust-fd90910f5f531ce33a483e765faf8ab497fcb990.tar.gz
rust-fd90910f5f531ce33a483e765faf8ab497fcb990.zip
Rollup merge of #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.
-rw-r--r--compiler/rustc_abi/src/layout.rs7
-rw-r--r--compiler/rustc_abi/src/lib.rs4
2 files changed, 5 insertions, 6 deletions
diff --git a/compiler/rustc_abi/src/layout.rs b/compiler/rustc_abi/src/layout.rs
index c57be5d1106..a95ef4c460f 100644
--- a/compiler/rustc_abi/src/layout.rs
+++ b/compiler/rustc_abi/src/layout.rs
@@ -2,7 +2,6 @@ use std::borrow::{Borrow, Cow};
 use std::cmp;
 use std::fmt::{self, Write};
 use std::iter;
-use std::num::NonZero;
 use std::ops::Bound;
 use std::ops::Deref;
 
@@ -11,8 +10,8 @@ use tracing::debug;
 
 use crate::{
     Abi, AbiAndPrefAlign, Align, FieldsShape, IndexSlice, IndexVec, Integer, LayoutS, Niche,
-    Primitive, ReprOptions, Scalar, Size, StructKind, TagEncoding, TargetDataLayout, Variants,
-    WrappingRange,
+    NonZeroUsize, Primitive, ReprOptions, Scalar, Size, StructKind, TagEncoding, TargetDataLayout,
+    Variants, WrappingRange,
 };
 
 // A variant is absent if it's uninhabited and only has ZST fields.
@@ -328,7 +327,7 @@ pub trait LayoutCalculator {
 
         Some(LayoutS {
             variants: Variants::Single { index: VariantIdx::new(0) },
-            fields: FieldsShape::Union(NonZero::new(only_variant.len())?),
+            fields: FieldsShape::Union(NonZeroUsize::new(only_variant.len())?),
             abi,
             largest_niche: None,
             align,
diff --git a/compiler/rustc_abi/src/lib.rs b/compiler/rustc_abi/src/lib.rs
index 9f2788c87c3..53aa8ad7cca 100644
--- a/compiler/rustc_abi/src/lib.rs
+++ b/compiler/rustc_abi/src/lib.rs
@@ -4,7 +4,7 @@
 #![cfg_attr(feature = "nightly", feature(rustdoc_internals))]
 
 use std::fmt;
-use std::num::{NonZero, ParseIntError};
+use std::num::{NonZeroUsize, ParseIntError};
 use std::ops::{Add, AddAssign, Mul, RangeInclusive, Sub};
 use std::str::FromStr;
 
@@ -1175,7 +1175,7 @@ pub enum FieldsShape<FieldIdx: Idx> {
     Primitive,
 
     /// All fields start at no offset. The `usize` is the field count.
-    Union(NonZero<usize>),
+    Union(NonZeroUsize),
 
     /// Array/vector-like placement, with all fields of identical types.
     Array { stride: Size, count: u64 },