Skip to content

Commit d0c8d3e

Browse files
authored
Rollup merge of #131997 - Veykril:veykril/push-upvqkyxmvkzw, r=jieyouxu
Make `rustc_abi` compile on stable again #131473 accidentally broke this
2 parents a9da2be + c7e6f1c commit d0c8d3e

4 files changed

Lines changed: 27 additions & 15 deletions

File tree

‎compiler/rustc_abi/src/callconv.rs‎

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,23 @@ mod abi {
33
pub(crate)usecrate::Variants;
44
}
55

6+
#[cfg(feature = "nightly")]
67
use rustc_macros::HashStable_Generic;
78

8-
usecrate::{Abi,Align,FieldsShape,HasDataLayout,Size,TyAbiInterface,TyAndLayout};
9+
#[cfg(feature = "nightly")]
10+
usecrate::{Abi,FieldsShape,TyAbiInterface,TyAndLayout};
11+
usecrate::{Align,HasDataLayout,Size};
912

10-
#[derive(Copy,Clone,PartialEq,Eq,Hash,Debug,HashStable_Generic)]
13+
#[cfg_attr(feature = "nightly", derive(HashStable_Generic))]
14+
#[derive(Copy,Clone,PartialEq,Eq,Hash,Debug)]
1115
pubenumRegKind{
1216
Integer,
1317
Float,
1418
Vector,
1519
}
1620

17-
#[derive(Copy,Clone,PartialEq,Eq,Hash,Debug,HashStable_Generic)]
21+
#[cfg_attr(feature = "nightly", derive(HashStable_Generic))]
22+
#[derive(Copy,Clone,PartialEq,Eq,Hash,Debug)]
1823
pubstructReg{
1924
pubkind:RegKind,
2025
pubsize:Size,
@@ -108,15 +113,8 @@ impl HomogeneousAggregate {
108113
}
109114
}
110115

116+
#[cfg(feature = "nightly")]
111117
impl<'a,Ty>TyAndLayout<'a,Ty>{
112-
/// Returns `true` if this is an aggregate type (including a ScalarPair!)
113-
pubfnis_aggregate(&self) -> bool{
114-
matchself.abi{
115-
Abi::Uninhabited | Abi::Scalar(_) | Abi::Vector{ .. } => false,
116-
Abi::ScalarPair(..) | Abi::Aggregate{ .. } => true,
117-
}
118-
}
119-
120118
/// Returns `Homogeneous` if this layout is an aggregate containing fields of
121119
/// only a single type (e.g., `(u32, u32)`). Such aggregates are often
122120
/// special-cased in ABIs.

‎compiler/rustc_abi/src/layout.rs‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@ use crate::{
1111
Variants,WrappingRange,
1212
};
1313

14+
#[cfg(feature = "nightly")]
1415
mod ty;
1516

17+
#[cfg(feature = "nightly")]
1618
pubuse ty::{FIRST_VARIANT,FieldIdx,Layout,TyAbiInterface,TyAndLayout,VariantIdx};
1719

1820
// A variant is absent if it's uninhabited and only has ZST fields.

‎compiler/rustc_abi/src/lib.rs‎

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,14 @@ mod layout;
2929
mod tests;
3030

3131
pubuse callconv::{Heterogeneous,HomogeneousAggregate,Reg,RegKind};
32-
pubuse layout::{
33-
FIRST_VARIANT,FieldIdx,Layout,LayoutCalculator,LayoutCalculatorError,TyAbiInterface,
34-
TyAndLayout,VariantIdx,
35-
};
32+
#[cfg(feature = "nightly")]
33+
pubuse layout::{FIRST_VARIANT,FieldIdx,Layout,TyAbiInterface,TyAndLayout,VariantIdx};
34+
pubuse layout::{LayoutCalculator,LayoutCalculatorError};
3635

3736
/// Requirements for a `StableHashingContext` to be used in this crate.
3837
/// This is a hack to allow using the `HashStable_Generic` derive macro
3938
/// instead of implementing everything in `rustc_middle`.
39+
#[cfg(feature = "nightly")]
4040
pubtraitHashStableContext{}
4141

4242
#[derive(Clone,Copy,PartialEq,Eq,Default)]
@@ -1644,6 +1644,14 @@ pub struct LayoutS<FieldIdx: Idx, VariantIdx: Idx> {
16441644
}
16451645

16461646
impl<FieldIdx:Idx,VariantIdx:Idx>LayoutS<FieldIdx,VariantIdx>{
1647+
/// Returns `true` if this is an aggregate type (including a ScalarPair!)
1648+
pubfnis_aggregate(&self) -> bool{
1649+
matchself.abi{
1650+
Abi::Uninhabited | Abi::Scalar(_) | Abi::Vector{ .. } => false,
1651+
Abi::ScalarPair(..) | Abi::Aggregate{ .. } => true,
1652+
}
1653+
}
1654+
16471655
pubfnscalar<C:HasDataLayout>(cx:&C,scalar:Scalar) -> Self{
16481656
let largest_niche = Niche::from_scalar(cx,Size::ZERO, scalar);
16491657
let size = scalar.size(cx);

‎tests/run-make/rustc-crates-on-stable/rmake.rs‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ fn main() {
3131
"rustc_pattern_analysis",
3232
"-p",
3333
"rustc_lexer",
34+
"-p",
35+
"rustc_abi",
36+
"-p",
37+
"rustc_parse_format",
3438
])
3539
.run();
3640
}

0 commit comments

Comments
 (0)