Skip to content

Commit 31e102c

Browse files
committed
Auto merge of rust-lang#132005 - matthiaskrgr:rollup-ced4upi, r=matthiaskrgr
Rollup of 7 pull requests Successful merges: - rust-lang#130350 (stabilize Strict Provenance and Exposed Provenance APIs) - rust-lang#131737 (linkchecker: add a reminder on broken links to add new/renamed pages to `SUMMARY.md` for mdBooks) - rust-lang#131991 (test: Add test for trait in FQS cast, issue rust-lang#98565) - rust-lang#131997 (Make `rustc_abi` compile on stable again) - rust-lang#131999 (Improve test coverage for `unit_bindings` lint) - rust-lang#132001 (fix coherence error for very large tuples™) - rust-lang#132003 (update ABI compatibility docs for new option-like rules) r? `@ghost` `@rustbot` modify labels: rollup
2 parents edbd939 + 64f4aa6 commit 31e102c

File tree

107 files changed

+613
-560
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

107 files changed

+613
-560
lines changed

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) use crate::Variants;
44
}
55

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

8-
use crate::{Abi, Align, FieldsShape, HasDataLayout, Size, TyAbiInterface, TyAndLayout};
9+
#[cfg(feature = "nightly")]
10+
use crate::{Abi, FieldsShape, TyAbiInterface, TyAndLayout};
11+
use crate::{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
pub enum RegKind {
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
pub struct Reg {
1924
pub kind: RegKind,
2025
pub size: 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-
pub fn is_aggregate(&self) -> bool {
114-
match self.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
pub use 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
pub use callconv::{Heterogeneous, HomogeneousAggregate, Reg, RegKind};
32-
pub use layout::{
33-
FIRST_VARIANT, FieldIdx, Layout, LayoutCalculator, LayoutCalculatorError, TyAbiInterface,
34-
TyAndLayout, VariantIdx,
35-
};
32+
#[cfg(feature = "nightly")]
33+
pub use layout::{FIRST_VARIANT, FieldIdx, Layout, TyAbiInterface, TyAndLayout, VariantIdx};
34+
pub use 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
pub trait HashStableContext {}
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+
pub fn is_aggregate(&self) -> bool {
1649+
match self.abi {
1650+
Abi::Uninhabited | Abi::Scalar(_) | Abi::Vector { .. } => false,
1651+
Abi::ScalarPair(..) | Abi::Aggregate { .. } => true,
1652+
}
1653+
}
1654+
16471655
pub fn scalar<C: HasDataLayout>(cx: &C, scalar: Scalar) -> Self {
16481656
let largest_niche = Niche::from_scalar(cx, Size::ZERO, scalar);
16491657
let size = scalar.size(cx);

compiler/rustc_arena/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
#![feature(maybe_uninit_slice)]
2424
#![feature(rustc_attrs)]
2525
#![feature(rustdoc_internals)]
26-
#![feature(strict_provenance)]
2726
#![warn(unreachable_pub)]
2827
// tidy-alphabetical-end
2928

compiler/rustc_codegen_ssa/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
#![feature(let_chains)]
1212
#![feature(negative_impls)]
1313
#![feature(rustdoc_internals)]
14-
#![feature(strict_provenance)]
1514
#![feature(trait_alias)]
1615
#![feature(try_blocks)]
1716
#![warn(unreachable_pub)]

compiler/rustc_codegen_ssa/src/mir/rvalue.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,12 +361,16 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
361361
(Int(..) | Float(_), Int(..) | Float(_)) => bx.bitcast(imm, to_backend_ty),
362362
(Pointer(..), Pointer(..)) => bx.pointercast(imm, to_backend_ty),
363363
(Int(..), Pointer(..)) => bx.ptradd(bx.const_null(bx.type_ptr()), imm),
364-
(Pointer(..), Int(..)) => bx.ptrtoint(imm, to_backend_ty),
364+
(Pointer(..), Int(..)) => {
365+
// FIXME: this exposes the provenance, which shouldn't be necessary.
366+
bx.ptrtoint(imm, to_backend_ty)
367+
}
365368
(Float(_), Pointer(..)) => {
366369
let int_imm = bx.bitcast(imm, bx.cx().type_isize());
367370
bx.ptradd(bx.const_null(bx.type_ptr()), int_imm)
368371
}
369372
(Pointer(..), Float(_)) => {
373+
// FIXME: this exposes the provenance, which shouldn't be necessary.
370374
let int_imm = bx.ptrtoint(imm, bx.cx().type_isize());
371375
bx.bitcast(int_imm, to_backend_ty)
372376
}

compiler/rustc_const_eval/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
#![feature(never_type)]
1111
#![feature(rustdoc_internals)]
1212
#![feature(slice_ptr_get)]
13-
#![feature(strict_provenance)]
1413
#![feature(trait_alias)]
1514
#![feature(try_blocks)]
1615
#![feature(unqualified_local_imports)]

compiler/rustc_data_structures/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
#![feature(ptr_alignment_type)]
3434
#![feature(rustc_attrs)]
3535
#![feature(rustdoc_internals)]
36-
#![feature(strict_provenance)]
3736
#![feature(test)]
3837
#![feature(thread_id_value)]
3938
#![feature(type_alias_impl_trait)]

compiler/rustc_feature/src/unstable.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -595,7 +595,7 @@ declare_features! (
595595
/// Allows attributes on expressions and non-item statements.
596596
(unstable, stmt_expr_attributes, "1.6.0", Some(15701)),
597597
/// Allows lints part of the strict provenance effort.
598-
(unstable, strict_provenance, "1.61.0", Some(95228)),
598+
(unstable, strict_provenance_lints, "1.61.0", Some(130351)),
599599
/// Allows string patterns to dereference values to match them.
600600
(unstable, string_deref_patterns, "1.67.0", Some(87121)),
601601
/// Allows the use of `#[target_feature]` on safe functions.

compiler/rustc_lint_defs/src/builtin.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2667,7 +2667,6 @@ declare_lint! {
26672667
/// ### Example
26682668
///
26692669
/// ```rust
2670-
/// #![feature(strict_provenance)]
26712670
/// #![warn(fuzzy_provenance_casts)]
26722671
///
26732672
/// fn main() {
@@ -2701,7 +2700,7 @@ declare_lint! {
27012700
pub FUZZY_PROVENANCE_CASTS,
27022701
Allow,
27032702
"a fuzzy integer to pointer cast is used",
2704-
@feature_gate = strict_provenance;
2703+
@feature_gate = strict_provenance_lints;
27052704
}
27062705

27072706
declare_lint! {
@@ -2711,7 +2710,6 @@ declare_lint! {
27112710
/// ### Example
27122711
///
27132712
/// ```rust
2714-
/// #![feature(strict_provenance)]
27152713
/// #![warn(lossy_provenance_casts)]
27162714
///
27172715
/// fn main() {
@@ -2747,7 +2745,7 @@ declare_lint! {
27472745
pub LOSSY_PROVENANCE_CASTS,
27482746
Allow,
27492747
"a lossy pointer to integer cast is used",
2750-
@feature_gate = strict_provenance;
2748+
@feature_gate = strict_provenance_lints;
27512749
}
27522750

27532751
declare_lint! {

0 commit comments

Comments
 (0)