Compare commits

..

3 Commits

Author SHA1 Message Date
David Abdurachmanov bbd264d0f1
rust-analyzer is missing
error: File not found: /builddir/build/BUILDROOT/rust-1.64.0-1.1.riscv64.fc37.riscv64/usr/bin/rust-analyzer

This is somehow not available thus let's skip it for now.

Signed-off-by: David Abdurachmanov <davidlt@rivosinc.com>
2022-11-27 13:07:25 +02:00
David Abdurachmanov bf872eda05
Revert 263edd43c5255084292329423c61a9d69715ebfa
Test reverting, based on:

https://github.com/rust-lang/rust/issues/102155

Signed-off-by: David Abdurachmanov <davidlt@rivosinc.com>
2022-11-26 16:36:55 +02:00
David Abdurachmanov 9d7ae82d71
Enable riscv64
Signed-off-by: David Abdurachmanov <davidlt@rivosinc.com>
2022-11-04 13:10:18 +02:00
15 changed files with 924 additions and 325 deletions

15
.gitignore vendored
View File

@ -405,18 +405,3 @@
/rustc-1.62.1-src.tar.xz
/rustc-1.63.0-src.tar.xz
/rustc-1.64.0-src.tar.xz
/rustc-1.65.0-src.tar.xz
/wasi-libc-wasi-sdk-16.tar.gz
/rustc-1.66.0-src.tar.xz
/wasi-libc-wasi-sdk-17.tar.gz
/rustc-1.66.1-src.tar.xz
/rustc-1.67.0-src.tar.xz
/rustc-1.67.1-src.tar.xz
/rustc-1.68.0-src.tar.xz
/wasi-libc-wasi-sdk-19.tar.gz
/rustc-1.68.1-src.tar.xz
/rustc-1.68.2-src.tar.xz
/rustc-1.69.0-src.tar.xz
/wasi-libc-1dfe5c302d1c5ab621f7abf04620fae92700fd22.tar.gz
/rustc-1.70.0-src.tar.xz
/wasi-libc-wasi-sdk-20.tar.gz

View File

@ -0,0 +1,565 @@
From 732cd3832432a6691c31e10dcac953df6a4253d6 Mon Sep 17 00:00:00 2001
From: David Abdurachmanov <davidlt@rivosinc.com>
Date: Sat, 26 Nov 2022 16:32:25 +0200
Subject: [PATCH] Revert "Auto merge of #99033 -
5225225:interpreter-validity-checks, r=oli-obk"
This reverts commit 263edd43c5255084292329423c61a9d69715ebfa, reversing
changes made to c2ecd3af87477147695aa3f6e1237e3185044e62.
---
Cargo.lock | 1 -
.../src/intrinsics/mod.rs | 15 ++++-
compiler/rustc_codegen_ssa/Cargo.toml | 1 -
compiler/rustc_codegen_ssa/src/mir/block.rs | 9 +--
.../src/const_eval/machine.rs | 2 +-
.../src/interpret/intrinsics.rs | 56 ++++++++--------
compiler/rustc_const_eval/src/lib.rs | 6 --
.../src/might_permit_raw_init.rs | 40 -----------
compiler/rustc_middle/src/query/mod.rs | 8 ---
compiler/rustc_middle/src/ty/query.rs | 1 -
compiler/rustc_query_impl/src/keys.rs | 12 +---
compiler/rustc_target/src/abi/mod.rs | 38 ++++++-----
.../intrinsics/panic-uninitialized-zeroed.rs | 66 +++++++------------
13 files changed, 94 insertions(+), 161 deletions(-)
delete mode 100644 compiler/rustc_const_eval/src/might_permit_raw_init.rs
diff --git a/Cargo.lock b/Cargo.lock
index 2569b3e1976..b88158f9ff8 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -3731,7 +3731,6 @@ dependencies = [
"rustc_arena",
"rustc_ast",
"rustc_attr",
- "rustc_const_eval",
"rustc_data_structures",
"rustc_errors",
"rustc_fs_util",
diff --git a/compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs b/compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs
index b2a83e1d4eb..4f9ced001d4 100644
--- a/compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs
+++ b/compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs
@@ -22,6 +22,7 @@ macro_rules! intrinsic_args {
use rustc_middle::ty::print::with_no_trimmed_paths;
use rustc_middle::ty::subst::SubstsRef;
use rustc_span::symbol::{kw, sym, Symbol};
+use rustc_target::abi::InitKind;
use crate::prelude::*;
use cranelift_codegen::ir::AtomicRmwOp;
@@ -693,7 +694,12 @@ fn swap(bcx: &mut FunctionBuilder<'_>, v: Value) -> Value {
return;
}
- if intrinsic == sym::assert_zero_valid && !fx.tcx.permits_zero_init(layout) {
+ if intrinsic == sym::assert_zero_valid
+ && !layout.might_permit_raw_init(
+ fx,
+ InitKind::Zero,
+ fx.tcx.sess.opts.unstable_opts.strict_init_checks) {
+
with_no_trimmed_paths!({
crate::base::codegen_panic(
fx,
@@ -707,7 +713,12 @@ fn swap(bcx: &mut FunctionBuilder<'_>, v: Value) -> Value {
return;
}
- if intrinsic == sym::assert_uninit_valid && !fx.tcx.permits_uninit_init(layout) {
+ if intrinsic == sym::assert_uninit_valid
+ && !layout.might_permit_raw_init(
+ fx,
+ InitKind::Uninit,
+ fx.tcx.sess.opts.unstable_opts.strict_init_checks) {
+
with_no_trimmed_paths!({
crate::base::codegen_panic(
fx,
diff --git a/compiler/rustc_codegen_ssa/Cargo.toml b/compiler/rustc_codegen_ssa/Cargo.toml
index 46d6344dbb2..e7ee424668b 100644
--- a/compiler/rustc_codegen_ssa/Cargo.toml
+++ b/compiler/rustc_codegen_ssa/Cargo.toml
@@ -40,7 +40,6 @@ rustc_metadata = { path = "../rustc_metadata" }
rustc_query_system = { path = "../rustc_query_system" }
rustc_target = { path = "../rustc_target" }
rustc_session = { path = "../rustc_session" }
-rustc_const_eval = { path = "../rustc_const_eval" }
[dependencies.object]
version = "0.29.0"
diff --git a/compiler/rustc_codegen_ssa/src/mir/block.rs b/compiler/rustc_codegen_ssa/src/mir/block.rs
index 3eee58d9d1c..a9eb4ec6439 100644
--- a/compiler/rustc_codegen_ssa/src/mir/block.rs
+++ b/compiler/rustc_codegen_ssa/src/mir/block.rs
@@ -22,7 +22,7 @@
use rustc_span::{sym, Symbol};
use rustc_symbol_mangling::typeid::typeid_for_fnabi;
use rustc_target::abi::call::{ArgAbi, FnAbi, PassMode};
-use rustc_target::abi::{self, HasDataLayout, WrappingRange};
+use rustc_target::abi::{self, HasDataLayout, InitKind, WrappingRange};
use rustc_target::spec::abi::Abi;
/// Used by `FunctionCx::codegen_terminator` for emitting common patterns
@@ -528,6 +528,7 @@ fn codegen_panic_intrinsic(
source_info: mir::SourceInfo,
target: Option<mir::BasicBlock>,
cleanup: Option<mir::BasicBlock>,
+ strict_validity: bool,
) -> bool {
// Emit a panic or a no-op for `assert_*` intrinsics.
// These are intrinsics that compile to panics so that we can get a message
@@ -546,13 +547,12 @@ enum AssertIntrinsic {
});
if let Some(intrinsic) = panic_intrinsic {
use AssertIntrinsic::*;
-
let ty = instance.unwrap().substs.type_at(0);
let layout = bx.layout_of(ty);
let do_panic = match intrinsic {
Inhabited => layout.abi.is_uninhabited(),
- ZeroValid => !bx.tcx().permits_zero_init(layout),
- UninitValid => !bx.tcx().permits_uninit_init(layout),
+ ZeroValid => !layout.might_permit_raw_init(bx, InitKind::Zero, strict_validity),
+ UninitValid => !layout.might_permit_raw_init(bx, InitKind::Uninit, strict_validity),
};
if do_panic {
let msg_str = with_no_visible_paths!({
@@ -687,6 +687,7 @@ fn codegen_call_terminator(
source_info,
target,
cleanup,
+ self.cx.tcx().sess.opts.unstable_opts.strict_init_checks,
) {
return;
}
diff --git a/compiler/rustc_const_eval/src/const_eval/machine.rs b/compiler/rustc_const_eval/src/const_eval/machine.rs
index fc2e6652a3d..ef6cff42ad9 100644
--- a/compiler/rustc_const_eval/src/const_eval/machine.rs
+++ b/compiler/rustc_const_eval/src/const_eval/machine.rs
@@ -104,7 +104,7 @@ pub struct CompileTimeInterpreter<'mir, 'tcx> {
}
impl<'mir, 'tcx> CompileTimeInterpreter<'mir, 'tcx> {
- pub(crate) fn new(const_eval_limit: Limit, can_access_statics: bool) -> Self {
+ pub(super) fn new(const_eval_limit: Limit, can_access_statics: bool) -> Self {
CompileTimeInterpreter {
steps_remaining: const_eval_limit.0,
stack: Vec::new(),
diff --git a/compiler/rustc_const_eval/src/interpret/intrinsics.rs b/compiler/rustc_const_eval/src/interpret/intrinsics.rs
index 08209eb7932..e0ce6d9acc8 100644
--- a/compiler/rustc_const_eval/src/interpret/intrinsics.rs
+++ b/compiler/rustc_const_eval/src/interpret/intrinsics.rs
@@ -15,7 +15,7 @@
use rustc_middle::ty::subst::SubstsRef;
use rustc_middle::ty::{Ty, TyCtxt};
use rustc_span::symbol::{sym, Symbol};
-use rustc_target::abi::{Abi, Align, Primitive, Size};
+use rustc_target::abi::{Abi, Align, InitKind, Primitive, Size};
use super::{
util::ensure_monomorphic_enough, CheckInAllocMsg, ImmTy, InterpCx, Machine, OpTy, PlaceTy,
@@ -435,33 +435,35 @@ pub fn emulate_intrinsic(
),
)?;
}
-
- if intrinsic_name == sym::assert_zero_valid {
- let should_panic = !self.tcx.permits_zero_init(layout);
-
- if should_panic {
- M::abort(
- self,
- format!(
- "aborted execution: attempted to zero-initialize type `{}`, which is invalid",
- ty
- ),
- )?;
- }
+ if intrinsic_name == sym::assert_zero_valid
+ && !layout.might_permit_raw_init(
+ self,
+ InitKind::Zero,
+ self.tcx.sess.opts.unstable_opts.strict_init_checks,
+ )
+ {
+ M::abort(
+ self,
+ format!(
+ "aborted execution: attempted to zero-initialize type `{}`, which is invalid",
+ ty
+ ),
+ )?;
}
-
- if intrinsic_name == sym::assert_uninit_valid {
- let should_panic = !self.tcx.permits_uninit_init(layout);
-
- if should_panic {
- M::abort(
- self,
- format!(
- "aborted execution: attempted to leave type `{}` uninitialized, which is invalid",
- ty
- ),
- )?;
- }
+ if intrinsic_name == sym::assert_uninit_valid
+ && !layout.might_permit_raw_init(
+ self,
+ InitKind::Uninit,
+ self.tcx.sess.opts.unstable_opts.strict_init_checks,
+ )
+ {
+ M::abort(
+ self,
+ format!(
+ "aborted execution: attempted to leave type `{}` uninitialized, which is invalid",
+ ty
+ ),
+ )?;
}
}
sym::simd_insert => {
diff --git a/compiler/rustc_const_eval/src/lib.rs b/compiler/rustc_const_eval/src/lib.rs
index 72ac6af685d..d65d4f7eb72 100644
--- a/compiler/rustc_const_eval/src/lib.rs
+++ b/compiler/rustc_const_eval/src/lib.rs
@@ -33,13 +33,11 @@
pub mod const_eval;
mod errors;
pub mod interpret;
-mod might_permit_raw_init;
pub mod transform;
pub mod util;
use rustc_middle::ty;
use rustc_middle::ty::query::Providers;
-use rustc_target::abi::InitKind;
pub fn provide(providers: &mut Providers) {
const_eval::provide(providers);
@@ -61,8 +59,4 @@ pub fn provide(providers: &mut Providers) {
let (param_env, value) = param_env_and_value.into_parts();
const_eval::deref_mir_constant(tcx, param_env, value)
};
- providers.permits_uninit_init =
- |tcx, ty| might_permit_raw_init::might_permit_raw_init(tcx, ty, InitKind::Uninit);
- providers.permits_zero_init =
- |tcx, ty| might_permit_raw_init::might_permit_raw_init(tcx, ty, InitKind::Zero);
}
diff --git a/compiler/rustc_const_eval/src/might_permit_raw_init.rs b/compiler/rustc_const_eval/src/might_permit_raw_init.rs
deleted file mode 100644
index f971c2238c7..00000000000
--- a/compiler/rustc_const_eval/src/might_permit_raw_init.rs
+++ /dev/null
@@ -1,40 +0,0 @@
-use crate::const_eval::CompileTimeInterpreter;
-use crate::interpret::{InterpCx, MemoryKind, OpTy};
-use rustc_middle::ty::layout::LayoutCx;
-use rustc_middle::ty::{layout::TyAndLayout, ParamEnv, TyCtxt};
-use rustc_session::Limit;
-use rustc_target::abi::InitKind;
-
-pub fn might_permit_raw_init<'tcx>(
- tcx: TyCtxt<'tcx>,
- ty: TyAndLayout<'tcx>,
- kind: InitKind,
-) -> bool {
- let strict = tcx.sess.opts.unstable_opts.strict_init_checks;
-
- if strict {
- let machine = CompileTimeInterpreter::new(Limit::new(0), false);
-
- let mut cx = InterpCx::new(tcx, rustc_span::DUMMY_SP, ParamEnv::reveal_all(), machine);
-
- let allocated = cx
- .allocate(ty, MemoryKind::Machine(crate::const_eval::MemoryKind::Heap))
- .expect("OOM: failed to allocate for uninit check");
-
- if kind == InitKind::Zero {
- cx.write_bytes_ptr(
- allocated.ptr,
- std::iter::repeat(0_u8).take(ty.layout.size().bytes_usize()),
- )
- .expect("failed to write bytes for zero valid check");
- }
-
- let ot: OpTy<'_, _> = allocated.into();
-
- // Assume that if it failed, it's a validation failure.
- cx.validate_operand(&ot).is_ok()
- } else {
- let layout_cx = LayoutCx { tcx, param_env: ParamEnv::reveal_all() };
- ty.might_permit_raw_init(&layout_cx, kind)
- }
-}
diff --git a/compiler/rustc_middle/src/query/mod.rs b/compiler/rustc_middle/src/query/mod.rs
index d8483e7e409..e498015a4a5 100644
--- a/compiler/rustc_middle/src/query/mod.rs
+++ b/compiler/rustc_middle/src/query/mod.rs
@@ -2049,12 +2049,4 @@
desc { |tcx| "looking up generator diagnostic data of `{}`", tcx.def_path_str(key) }
separate_provide_extern
}
-
- query permits_uninit_init(key: TyAndLayout<'tcx>) -> bool {
- desc { "checking to see if {:?} permits being left uninit", key.ty }
- }
-
- query permits_zero_init(key: TyAndLayout<'tcx>) -> bool {
- desc { "checking to see if {:?} permits being left zeroed", key.ty }
- }
}
diff --git a/compiler/rustc_middle/src/ty/query.rs b/compiler/rustc_middle/src/ty/query.rs
index 2452bcf6a61..3d662ed5de4 100644
--- a/compiler/rustc_middle/src/ty/query.rs
+++ b/compiler/rustc_middle/src/ty/query.rs
@@ -28,7 +28,6 @@
use crate::traits::specialization_graph;
use crate::traits::{self, ImplSource};
use crate::ty::fast_reject::SimplifiedType;
-use crate::ty::layout::TyAndLayout;
use crate::ty::subst::{GenericArg, SubstsRef};
use crate::ty::util::AlwaysRequiresDrop;
use crate::ty::GeneratorDiagnosticData;
diff --git a/compiler/rustc_query_impl/src/keys.rs b/compiler/rustc_query_impl/src/keys.rs
index 49175e97f41..4d6bb02c38e 100644
--- a/compiler/rustc_query_impl/src/keys.rs
+++ b/compiler/rustc_query_impl/src/keys.rs
@@ -6,7 +6,7 @@
use rustc_middle::traits;
use rustc_middle::ty::fast_reject::SimplifiedType;
use rustc_middle::ty::subst::{GenericArg, SubstsRef};
-use rustc_middle::ty::{self, layout::TyAndLayout, Ty, TyCtxt};
+use rustc_middle::ty::{self, Ty, TyCtxt};
use rustc_span::symbol::{Ident, Symbol};
use rustc_span::{Span, DUMMY_SP};
@@ -395,16 +395,6 @@ fn default_span(&self, _: TyCtxt<'_>) -> Span {
}
}
-impl<'tcx> Key for TyAndLayout<'tcx> {
- #[inline(always)]
- fn query_crate_is_local(&self) -> bool {
- true
- }
- fn default_span(&self, _: TyCtxt<'_>) -> Span {
- DUMMY_SP
- }
-}
-
impl<'tcx> Key for (Ty<'tcx>, Ty<'tcx>) {
#[inline(always)]
fn query_crate_is_local(&self) -> bool {
diff --git a/compiler/rustc_target/src/abi/mod.rs b/compiler/rustc_target/src/abi/mod.rs
index 92ce4d91d84..d103a06060d 100644
--- a/compiler/rustc_target/src/abi/mod.rs
+++ b/compiler/rustc_target/src/abi/mod.rs
@@ -1378,7 +1378,7 @@ pub struct PointeeInfo {
/// Used in `might_permit_raw_init` to indicate the kind of initialisation
/// that is checked to be valid
-#[derive(Copy, Clone, Debug, PartialEq, Eq)]
+#[derive(Copy, Clone, Debug)]
pub enum InitKind {
Zero,
Uninit,
@@ -1493,18 +1493,14 @@ pub fn is_zst(&self) -> bool {
///
/// `init_kind` indicates if the memory is zero-initialized or left uninitialized.
///
- /// This code is intentionally conservative, and will not detect
- /// * zero init of an enum whose 0 variant does not allow zero initialization
- /// * making uninitialized types who have a full valid range (ints, floats, raw pointers)
- /// * Any form of invalid value being made inside an array (unless the value is uninhabited)
+ /// `strict` is an opt-in debugging flag added in #97323 that enables more checks.
///
- /// A strict form of these checks that uses const evaluation exists in
- /// `rustc_const_eval::might_permit_raw_init`, and a tracking issue for making these checks
- /// stricter is <https://github.com/rust-lang/rust/issues/66151>.
+ /// This is conservative: in doubt, it will answer `true`.
///
- /// FIXME: Once all the conservatism is removed from here, and the checks are ran by default,
- /// we can use the const evaluation checks always instead.
- pub fn might_permit_raw_init<C>(self, cx: &C, init_kind: InitKind) -> bool
+ /// FIXME: Once we removed all the conservatism, we could alternatively
+ /// create an all-0/all-undef constant and run the const value validator to see if
+ /// this is a valid value for the given type.
+ pub fn might_permit_raw_init<C>(self, cx: &C, init_kind: InitKind, strict: bool) -> bool
where
Self: Copy,
Ty: TyAbiInterface<'a, C>,
@@ -1517,8 +1513,13 @@ pub fn might_permit_raw_init<C>(self, cx: &C, init_kind: InitKind) -> bool
s.valid_range(cx).contains(0)
}
InitKind::Uninit => {
- // The range must include all values.
- s.is_always_valid(cx)
+ if strict {
+ // The type must be allowed to be uninit (which means "is a union").
+ s.is_uninit_valid()
+ } else {
+ // The range must include all values.
+ s.is_always_valid(cx)
+ }
}
}
};
@@ -1539,12 +1540,19 @@ pub fn might_permit_raw_init<C>(self, cx: &C, init_kind: InitKind) -> bool
// If we have not found an error yet, we need to recursively descend into fields.
match &self.fields {
FieldsShape::Primitive | FieldsShape::Union { .. } => {}
- FieldsShape::Array { .. } => {
+ FieldsShape::Array { count, .. } => {
// FIXME(#66151): For now, we are conservative and do not check arrays by default.
+ if strict
+ && *count > 0
+ && !self.field(cx, 0).might_permit_raw_init(cx, init_kind, strict)
+ {
+ // Found non empty array with a type that is unhappy about this kind of initialization
+ return false;
+ }
}
FieldsShape::Arbitrary { offsets, .. } => {
for idx in 0..offsets.len() {
- if !self.field(cx, idx).might_permit_raw_init(cx, init_kind) {
+ if !self.field(cx, idx).might_permit_raw_init(cx, init_kind, strict) {
// We found a field that is unhappy with this kind of initialization.
return false;
}
diff --git a/src/test/ui/intrinsics/panic-uninitialized-zeroed.rs b/src/test/ui/intrinsics/panic-uninitialized-zeroed.rs
index 255151a9603..3ffd35ecdb8 100644
--- a/src/test/ui/intrinsics/panic-uninitialized-zeroed.rs
+++ b/src/test/ui/intrinsics/panic-uninitialized-zeroed.rs
@@ -57,13 +57,6 @@ enum LR_NonZero {
struct ZeroSized;
-#[allow(dead_code)]
-#[repr(i32)]
-enum ZeroIsValid {
- Zero(u8) = 0,
- One(NonNull<()>) = 1,
-}
-
fn test_panic_msg<T>(op: impl (FnOnce() -> T) + panic::UnwindSafe, msg: &str) {
let err = panic::catch_unwind(op).err();
assert_eq!(
@@ -159,12 +152,33 @@ fn main() {
"attempted to zero-initialize type `*const dyn core::marker::Send`, which is invalid"
);
+ /* FIXME(#66151) we conservatively do not error here yet.
+ test_panic_msg(
+ || mem::uninitialized::<LR_NonZero>(),
+ "attempted to leave type `LR_NonZero` uninitialized, which is invalid"
+ );
+ test_panic_msg(
+ || mem::zeroed::<LR_NonZero>(),
+ "attempted to zero-initialize type `LR_NonZero`, which is invalid"
+ );
+
+ test_panic_msg(
+ || mem::uninitialized::<ManuallyDrop<LR_NonZero>>(),
+ "attempted to leave type `std::mem::ManuallyDrop<LR_NonZero>` uninitialized, \
+ which is invalid"
+ );
+ test_panic_msg(
+ || mem::zeroed::<ManuallyDrop<LR_NonZero>>(),
+ "attempted to zero-initialize type `std::mem::ManuallyDrop<LR_NonZero>`, \
+ which is invalid"
+ );
+ */
+
test_panic_msg(
|| mem::uninitialized::<(NonNull<u32>, u32, u32)>(),
"attempted to leave type `(core::ptr::non_null::NonNull<u32>, u32, u32)` uninitialized, \
which is invalid"
);
-
test_panic_msg(
|| mem::zeroed::<(NonNull<u32>, u32, u32)>(),
"attempted to zero-initialize type `(core::ptr::non_null::NonNull<u32>, u32, u32)`, \
@@ -182,23 +196,11 @@ fn main() {
which is invalid"
);
- test_panic_msg(
- || mem::uninitialized::<LR_NonZero>(),
- "attempted to leave type `LR_NonZero` uninitialized, which is invalid"
- );
-
- test_panic_msg(
- || mem::uninitialized::<ManuallyDrop<LR_NonZero>>(),
- "attempted to leave type `core::mem::manually_drop::ManuallyDrop<LR_NonZero>` uninitialized, \
- which is invalid"
- );
-
test_panic_msg(
|| mem::uninitialized::<NoNullVariant>(),
"attempted to leave type `NoNullVariant` uninitialized, \
which is invalid"
);
-
test_panic_msg(
|| mem::zeroed::<NoNullVariant>(),
"attempted to zero-initialize type `NoNullVariant`, \
@@ -210,12 +212,10 @@ fn main() {
|| mem::uninitialized::<bool>(),
"attempted to leave type `bool` uninitialized, which is invalid"
);
-
test_panic_msg(
|| mem::uninitialized::<LR>(),
"attempted to leave type `LR` uninitialized, which is invalid"
);
-
test_panic_msg(
|| mem::uninitialized::<ManuallyDrop<LR>>(),
"attempted to leave type `core::mem::manually_drop::ManuallyDrop<LR>` uninitialized, which is invalid"
@@ -229,7 +229,6 @@ fn main() {
let _val = mem::zeroed::<Option<&'static i32>>();
let _val = mem::zeroed::<MaybeUninit<NonNull<u32>>>();
let _val = mem::zeroed::<[!; 0]>();
- let _val = mem::zeroed::<ZeroIsValid>();
let _val = mem::uninitialized::<MaybeUninit<bool>>();
let _val = mem::uninitialized::<[!; 0]>();
let _val = mem::uninitialized::<()>();
@@ -260,33 +259,12 @@ fn main() {
|| mem::zeroed::<[NonNull<()>; 1]>(),
"attempted to zero-initialize type `[core::ptr::non_null::NonNull<()>; 1]`, which is invalid"
);
-
- // FIXME(#66151) we conservatively do not error here yet (by default).
- test_panic_msg(
- || mem::zeroed::<LR_NonZero>(),
- "attempted to zero-initialize type `LR_NonZero`, which is invalid"
- );
-
- test_panic_msg(
- || mem::zeroed::<ManuallyDrop<LR_NonZero>>(),
- "attempted to zero-initialize type `core::mem::manually_drop::ManuallyDrop<LR_NonZero>`, \
- which is invalid"
- );
} else {
// These are UB because they have not been officially blessed, but we await the resolution
// of <https://github.com/rust-lang/unsafe-code-guidelines/issues/71> before doing
// anything about that.
let _val = mem::uninitialized::<i32>();
let _val = mem::uninitialized::<*const ()>();
-
- // These are UB, but best to test them to ensure we don't become unintentionally
- // stricter.
-
- // It's currently unchecked to create invalid enums and values inside arrays.
- let _val = mem::zeroed::<LR_NonZero>();
- let _val = mem::zeroed::<[LR_NonZero; 1]>();
- let _val = mem::zeroed::<[NonNull<()>; 1]>();
- let _val = mem::uninitialized::<[NonNull<()>; 1]>();
}
}
}
--
2.37.1

View File

@ -1,4 +1,4 @@
From 37cb177eb53145103ae72b67562884782dde01c3 Mon Sep 17 00:00:00 2001
From b521511174b1a08dddfac243604d649b71cc7386 Mon Sep 17 00:00:00 2001
From: Ivan Mironov <mironov.ivan@gmail.com>
Date: Sun, 8 Dec 2019 17:23:08 +0500
Subject: [PATCH] Use lld provided by system for wasm
@ -8,19 +8,19 @@ Subject: [PATCH] Use lld provided by system for wasm
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/compiler/rustc_target/src/spec/wasm_base.rs b/compiler/rustc_target/src/spec/wasm_base.rs
index 528a84a8b37c..353d742161d1 100644
index de7b7374af31..eebbe616e9b6 100644
--- a/compiler/rustc_target/src/spec/wasm_base.rs
+++ b/compiler/rustc_target/src/spec/wasm_base.rs
@@ -89,8 +89,7 @@ macro_rules! args {
@@ -99,8 +99,7 @@ pub fn options() -> TargetOptions {
// arguments just yet
limit_rdylib_exports: false,
- // we use the LLD shipped with the Rust toolchain by default
- linker: Some("rust-lld".into()),
+ linker: Some("lld".into()),
linker_flavor: LinkerFlavor::WasmLld(Cc::No),
lld_flavor: LldFlavor::Wasm,
linker_is_gnu: false,
pre_link_args,
--
2.38.1
2.35.1

View File

@ -0,0 +1,53 @@
From 2946828fcb8e2e68a16839dfcf4319bf119f8acd Mon Sep 17 00:00:00 2001
From: Josh Stone <jistone@redhat.com>
Date: Tue, 20 Sep 2022 13:03:43 -0700
Subject: [PATCH] rustc_transmute: fix big-endian discriminants
(cherry picked from commit a72666ed56ec5f1b6d254c7020cf86143edc6dbd)
---
compiler/rustc_transmute/src/layout/tree.rs | 22 +++++++++++++++------
1 file changed, 16 insertions(+), 6 deletions(-)
diff --git a/compiler/rustc_transmute/src/layout/tree.rs b/compiler/rustc_transmute/src/layout/tree.rs
index 70b3ba02b05b..e4fcde35ed37 100644
--- a/compiler/rustc_transmute/src/layout/tree.rs
+++ b/compiler/rustc_transmute/src/layout/tree.rs
@@ -402,7 +402,7 @@ fn from_repr_c_variant(
.unwrap();
tracing::trace!(?discr_layout, "computed discriminant layout");
variant_layout = variant_layout.extend(discr_layout).unwrap().0;
- tree = tree.then(Self::from_disr(discr, tcx, layout_summary.discriminant_size));
+ tree = tree.then(Self::from_discr(discr, tcx, layout_summary.discriminant_size));
}
// Next come fields.
@@ -442,11 +442,21 @@ fn from_repr_c_variant(
Ok(tree)
}
- pub fn from_disr(discr: Discr<'tcx>, tcx: TyCtxt<'tcx>, size: usize) -> Self {
- // FIXME(@jswrenn): I'm certain this is missing needed endian nuance.
- let bytes = discr.val.to_ne_bytes();
- let bytes = &bytes[..size];
- Self::Seq(bytes.into_iter().copied().map(|b| Self::from_bits(b)).collect())
+ pub fn from_discr(discr: Discr<'tcx>, tcx: TyCtxt<'tcx>, size: usize) -> Self {
+ use rustc_target::abi::Endian;
+
+ let bytes: [u8; 16];
+ let bytes = match tcx.data_layout.endian {
+ Endian::Little => {
+ bytes = discr.val.to_le_bytes();
+ &bytes[..size]
+ }
+ Endian::Big => {
+ bytes = discr.val.to_be_bytes();
+ &bytes[bytes.len() - size..]
+ }
+ };
+ Self::Seq(bytes.iter().map(|&b| Self::from_bits(b)).collect())
}
}
--
2.37.3

View File

@ -1,5 +1,6 @@
summary: CI Gating Plan
discover:
how: fmf
directory: tests
execute:
how: tmt
how: beakerlib

View File

@ -1,8 +0,0 @@
---
debuginfo:
ignore:
# i686 has limited debuginfo. From rust.spec
# full debuginfo is exhausting memory; just do libstd for now
# https://github.com/rust-lang/rust/issues/45854
- /usr/lib/debug/usr/bin/rustc-*.i386.debug

333
rust.spec
View File

@ -1,4 +1,4 @@
# Only x86_64, i686, and aarch64 are Tier 1 platforms at this time.
# Only x86_64 and i686 are Tier 1 platforms at this time.
# https://doc.rust-lang.org/nightly/rustc/platform-support.html
%global rust_arches x86_64 i686 armv7hl aarch64 ppc64le s390x riscv64
@ -8,9 +8,9 @@
# To bootstrap from scratch, set the channel and date from src/stage0.json
# e.g. 1.59.0 wants rustc: 1.58.0-2022-01-13
# or nightly wants some beta-YYYY-MM-DD
%global bootstrap_version 1.69.0
%global bootstrap_channel 1.69.0
%global bootstrap_date 2023-04-20
%global bootstrap_version 1.63.0
%global bootstrap_channel 1.63.0
%global bootstrap_date 2022-08-11
# Only the specified arches will use bootstrap binaries.
# NOTE: Those binaries used to be uploaded with every new release, but that was
@ -35,26 +35,26 @@
# src/ci/docker/host-x86_64/dist-various-2/build-wasi-toolchain.sh
# (updated per https://github.com/rust-lang/rust/pull/96907)
%global wasi_libc_url https://github.com/WebAssembly/wasi-libc
%global wasi_libc_ref wasi-sdk-20
%global wasi_libc_name wasi-libc-%{wasi_libc_ref}
%global wasi_libc_source %{wasi_libc_url}/archive/%{wasi_libc_ref}/%{wasi_libc_name}.tar.gz
%global wasi_libc_commit 9886d3d6200fcc3726329966860fc058707406cd
%global wasi_libc_name wasi-libc-%{wasi_libc_commit}
%global wasi_libc_source %{wasi_libc_url}/archive/%{wasi_libc_commit}/%{wasi_libc_name}.tar.gz
%global wasi_libc_dir %{_builddir}/%{wasi_libc_name}
# Using llvm-static may be helpful as an opt-in, e.g. to aid LLVM rebases.
%bcond_with llvm_static
# We can also choose to just use Rust's bundled LLVM, in case the system LLVM
# is insufficient. Rust currently requires LLVM 14.0+.
%global min_llvm_version 14.0.0
%global bundled_llvm_version 16.0.2
# is insufficient. Rust currently requires LLVM 12.0+.
%global min_llvm_version 12.0.0
%global bundled_llvm_version 14.0.6
%bcond_with bundled_llvm
# Requires stable libgit2 1.6, and not the next minor soname change.
# Requires stable libgit2 1.4, and not the next minor soname change.
# This needs to be consistent with the bindings in vendor/libgit2-sys.
%global min_libgit2_version 1.6.0
%global next_libgit2_version 1.7.0~
%global bundled_libgit2_version 1.6.3
%if 0%{?fedora} >= 38
%global min_libgit2_version 1.4.0
%global next_libgit2_version 1.5.0~
%global bundled_libgit2_version 1.4.2
%if 0%{?fedora} >= 99
%bcond_with bundled_libgit2
%else
%bcond_without bundled_libgit2
@ -76,15 +76,19 @@
%endif
# LLDB isn't available everywhere...
%ifnarch riscv64
%if 0%{?rhel} && 0%{?rhel} < 8
%bcond_with lldb
%else
%bcond_without lldb
%endif
%else
%bcond_with lldb
%endif
Name: rust
Version: 1.70.0
Release: 1%{?dist}
Version: 1.64.0
Release: 1.2.riscv64%{?dist}
Summary: The Rust Programming Language
License: (ASL 2.0 or MIT) and (BSD and MIT)
# ^ written as: (rust itself) and (bundled libraries)
@ -104,19 +108,28 @@ Source1: %{wasi_libc_source}
Patch1: 0001-Use-lld-provided-by-system-for-wasm.patch
# Set a substitute-path in rust-gdb for standard library sources.
Patch2: rustc-1.70.0-rust-gdb-substitute-path.patch
Patch2: rustc-1.61.0-rust-gdb-substitute-path.patch
# https://github.com/rust-lang/rust/pull/102076
Patch3: 0001-rustc_transmute-fix-big-endian-discriminants.patch
Patch7: 0001-Revert-Auto-merge-of-99033-5225225-interpreter-valid.patch
### RHEL-specific patches below ###
# Simple rpm macros for rust-toolset (as opposed to full rust-packaging)
Source100: macros.rust-toolset
# Disable cargo->libgit2->libssh2 on RHEL, as it's not approved for FIPS (rhbz1732949)
Patch100: rustc-1.70.0-disable-libssh2.patch
Patch100: rustc-1.59.0-disable-libssh2.patch
# libcurl on RHEL7 doesn't have http2, but since cargo requests it, curl-sys
# will try to build it statically -- instead we turn off the feature.
Patch101: rustc-1.70.0-disable-http2.patch
Patch101: rustc-1.63.0-disable-http2.patch
# kernel rh1410097 causes too-small stacks for PIE.
# (affects RHEL6 kernels when building for RHEL7)
Patch102: rustc-1.64.0-no-default-pie.patch
# Get the Rust triple for any arch.
%{lua: function rust_triple(arch)
@ -134,14 +147,7 @@ Patch101: rustc-1.70.0-disable-http2.patch
return arch.."-unknown-linux-"..abi
end}
# Get the environment form of a Rust triple
%{lua: function rust_triple_env(triple)
local sub = string.gsub(triple, "-", "_")
return string.upper(sub)
end}
%global rust_triple %{lua: print(rust_triple(rpm.expand("%{_target_cpu}")))}
%global rust_triple_env %{lua: print(rust_triple_env(rpm.expand("%{rust_triple}")))}
%if %defined bootstrap_arches
# For each bootstrap arch, add an additional binary Source.
@ -217,7 +223,7 @@ Provides: bundled(llvm) = %{bundled_llvm_version}
%else
BuildRequires: cmake >= 2.8.11
%if 0%{?epel} == 7
%global llvm llvm14
%global llvm llvm13
%endif
%if %defined llvm
%global llvm_root %{_libdir}/%{llvm}
@ -254,7 +260,7 @@ Requires: %{name}-std-static%{?_isa} = %{version}-%{release}
Requires: /usr/bin/cc
%if 0%{?epel} == 7
%global devtoolset_name devtoolset-11
%global devtoolset_name devtoolset-9
BuildRequires: %{devtoolset_name}-binutils
BuildRequires: %{devtoolset_name}-gcc
BuildRequires: %{devtoolset_name}-gcc-c++
@ -319,10 +325,6 @@ find '%{buildroot}%{rustlibdir}'/wasm*/lib -type f -regex '.*\\.\\(a\\|rlib\\)'
%{nil}
%endif
# This component was removed as of Rust 1.69.0.
# https://github.com/rust-lang/rust/pull/101841
Obsoletes: %{name}-analysis < 1.69.0~
%description
Rust is a systems programming language that runs blazingly fast, prevents
segfaults, and guarantees thread safety.
@ -332,9 +334,8 @@ This package includes the Rust compiler and documentation generator.
%package std-static
Summary: Standard library for Rust
Provides: %{name}-std-static-%{rust_triple} = %{version}-%{release}
Requires: %{name} = %{version}-%{release}
Requires: glibc-devel%{?_isa} >= 2.17
Requires: glibc-devel%{?_isa} >= 2.11
%description std-static
This package includes the standard libraries for building applications
@ -444,12 +445,6 @@ Summary: Documentation for Rust
# Koji will fail the build in rpmdiff if two architectures build a noarch
# subpackage differently, so instead we have to keep its arch.
# Cargo no longer builds its own documentation
# https://github.com/rust-lang/cargo/pull/4904
# We used to keep a shim cargo-doc package, but now that's merged too.
Obsoletes: cargo-doc < 1.65.0~
Provides: cargo-doc = %{version}-%{release}
%description doc
This package includes HTML documentation for the Rust programming language and
its standard library.
@ -475,6 +470,17 @@ Cargo is a tool that allows Rust projects to declare their various dependencies
and ensure that you'll always get a repeatable build.
%package -n cargo-doc
Summary: Documentation for Cargo
BuildArch: noarch
# Cargo no longer builds its own documentation
# https://github.com/rust-lang/cargo/pull/4904
Requires: %{name}-doc = %{version}-%{release}
%description -n cargo-doc
This package includes HTML documentation for Cargo.
%package -n rustfmt
Summary: Tool to find and fix Rust formatting issues
Requires: cargo
@ -487,21 +493,28 @@ Provides: rustfmt-preview = %{version}-%{release}
A tool for formatting Rust code according to style guidelines.
%package analyzer
Summary: Rust implementation of the Language Server Protocol
# The standard library sources are needed for most functionality.
%if 0%{?rhel} && 0%{?rhel} < 8
Requires: %{name}-src
%else
Recommends: %{name}-src
%package -n rls
Summary: Rust Language Server for IDE integration (deprecated)
%if %with bundled_libgit2
Provides: bundled(libgit2) = %{bundled_libgit2_version}
%endif
Requires: %{name}-analysis
# /usr/bin/rls is dynamically linked against internal rustc libs
Requires: %{name}%{?_isa} = %{version}-%{release}
# RLS is no longer available as of Rust 1.65, but we're including the stub
# binary that implements LSP just enough to recommend rust-analyzer.
Obsoletes: rls < 1.65.0~
# The component/package was rls-preview until Rust 1.31.
Obsoletes: rls-preview < 1.31.6
Provides: rls-preview = %{version}-%{release}
%description -n rls
The Rust Language Server provides a server that runs in the background,
providing IDEs, editors, and other tools with information about Rust programs.
RLS is being deprecated in favor of rust-analyzer, and may be removed in the future.
https://blog.rust-lang.org/2022/07/01/RLS-deprecation.html
%package analyzer
Summary: Rust implementation of the Language Server Protocol
%description analyzer
rust-analyzer is an implementation of Language Server Protocol for the Rust
@ -526,24 +539,28 @@ A collection of lints to catch common mistakes and improve your Rust code.
%package src
Summary: Sources for the Rust standard library
BuildArch: noarch
%if 0%{?rhel} && 0%{?rhel} < 8
Requires: %{name}-std-static = %{version}-%{release}
%else
Recommends: %{name}-std-static = %{version}-%{release}
%endif
%description src
This package includes source files for the Rust standard library. It may be
useful as a reference for code completion tools in various editors.
%if 0%{?rhel}
%package analysis
Summary: Compiler analysis data for the Rust standard library
Requires: %{name}-std-static%{?_isa} = %{version}-%{release}
%description analysis
This package contains analysis data files produced with rustc's -Zsave-analysis
feature for the Rust standard library. The RLS (Rust Language Server) uses this
data to provide information about the Rust standard library.
%if 0%{?rhel} && 0%{?rhel} >= 8
%package toolset
Summary: Rust Toolset
BuildArch: noarch
Requires: rust = %{version}-%{release}
Requires: cargo = %{version}-%{release}
Requires: rust%{?_isa} = %{version}-%{release}
Requires: cargo%{?_isa} = %{version}-%{release}
%description toolset
This is the metapackage for Rust Toolset, bringing in the Rust compiler,
@ -572,16 +589,22 @@ test -f '%{local_rust_root}/bin/rustc'
%setup -q -n %{rustc_package}
%patch -P1 -p1
%patch -P2 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch7 -p1
%if %with disabled_libssh2
%patch -P100 -p1
%patch100 -p1
%endif
%if %without curl_http2
%patch -P101 -p1
rm -rf vendor/libnghttp2-sys*/
%patch101 -p1
rm -rf vendor/libnghttp2-sys/
%endif
%if 0%{?rhel} && 0%{?rhel} < 8
%patch102 -p1
%endif
# Use our explicit python3 first
@ -596,21 +619,21 @@ mkdir -p src/llvm-project/libunwind/
%endif
# Remove other unused vendored libraries
rm -rf vendor/curl-sys*/curl/
rm -rf vendor/curl-sys/curl/
rm -rf vendor/*jemalloc-sys*/jemalloc/
rm -rf vendor/libffi-sys*/libffi/
rm -rf vendor/libmimalloc-sys*/c_src/mimalloc/
rm -rf vendor/libssh2-sys*/libssh2/
rm -rf vendor/libz-sys*/src/zlib{,-ng}/
rm -rf vendor/lzma-sys*/xz-*/
rm -rf vendor/openssl-src*/openssl/
rm -rf vendor/libmimalloc-sys/c_src/mimalloc/
rm -rf vendor/libssh2-sys/libssh2/
rm -rf vendor/libz-sys/src/zlib/
rm -rf vendor/libz-sys/src/zlib-ng/
rm -rf vendor/lzma-sys/xz-*/
rm -rf vendor/openssl-src/openssl/
%if %without bundled_libgit2
rm -rf vendor/libgit2-sys*/libgit2/
rm -rf vendor/libgit2-sys/libgit2/
%endif
%if %with disabled_libssh2
rm -rf vendor/libssh2-sys*/
rm -rf vendor/libssh2-sys/
%endif
# This only affects the transient rust-installer, but let it use our dynamic xz-libs
@ -639,32 +662,9 @@ find vendor -name .cargo-checksum.json \
# it's a shebang and make them executable. Then brp-mangle-shebangs gets upset...
find -name '*.rs' -type f -perm /111 -exec chmod -v -x '{}' '+'
# The distro flags are only appropriate for the host, not our cross-targets,
# and they're not as fine-grained as the settings we choose for std vs rustc.
%if %defined build_rustflags
%global build_rustflags %{nil}
%endif
# These are similar to __cflags_arch_* in /usr/lib/rpm/redhat/macros
%if 0%{?fedora} || 0%{?rhel} >= 9
%ifarch x86_64
%global rust_target_cpu %[0%{?rhel} >= 10 ? "x86-64-v3" : ""]
%global rust_target_cpu %[0%{?rhel} == 9 ? "x86-64-v2" : "%{rust_target_cpu}"]
%endif
%ifarch s390x
%global rust_target_cpu %[0%{?rhel} >= 9 ? "z14" : "zEC12"]
%endif
%ifarch ppc64le
%global rust_target_cpu %[0%{?rhel} >= 9 ? "pwr9" : "pwr8"]
%endif
%endif
# Set up shared environment variables for build/install/check
%global rust_env %{?rustflags:RUSTFLAGS="%{rustflags}"}
%if "%{?rust_target_cpu}" != ""
%global rust_env %{?rust_env} CARGO_TARGET_%{rust_triple_env}_RUSTFLAGS=-Ctarget-cpu=%{rust_target_cpu}
%endif
%if %defined cmake_path
%if 0%{?cmake_path:1}
%global rust_env %{?rust_env} PATH="%{cmake_path}:$PATH"
%endif
%if %without disabled_libssh2
@ -673,10 +673,11 @@ find -name '*.rs' -type f -perm /111 -exec chmod -v -x '{}' '+'
%endif
%global export_rust_env %{?rust_env:export %{rust_env}}
%build
%{export_rust_env}
%ifarch %{arm} %{ix86}
%ifarch %{arm} %{ix86} s390x riscv64
# full debuginfo is exhausting memory; just do libstd for now
# https://github.com/rust-lang/rust/issues/45854
%if 0%{?rhel} && 0%{?rhel} < 8
@ -753,29 +754,22 @@ end}
--disable-rpath \
%{enable_debuginfo} \
--set rust.codegen-units-std=1 \
--set build.build-stage=2 \
--set build.doc-stage=2 \
--set build.install-stage=2 \
--set build.test-stage=2 \
--enable-extended \
--tools=cargo,clippy,rls,rust-analyzer,rustfmt,src \
--tools=analysis,cargo,clippy,rls,rust-analyzer,rustfmt,src \
--enable-vendor \
--enable-verbose-tests \
--dist-compression-formats=gz \
--release-channel=%{channel} \
--release-description="%{?fedora:Fedora }%{?rhel:Red Hat }%{version}-%{release}"
%{__python3} ./x.py build -j "$ncpus"
%{__python3} ./x.py doc
%{__python3} ./x.py build -j "$ncpus" --stage 2
%{__python3} ./x.py doc --stage 2
for triple in %{?mingw_targets} %{?wasm_targets}; do
%{__python3} ./x.py build --target=$triple std
%{__python3} ./x.py build --stage 2 --target=$triple std
done
%install
%if 0%{?rhel} && 0%{?rhel} <= 9
%{?set_build_flags}
%endif
%{export_rust_env}
DESTDIR=%{buildroot} %{__python3} ./x.py install
@ -784,9 +778,6 @@ for triple in %{?mingw_targets} %{?wasm_targets}; do
DESTDIR=%{buildroot} %{__python3} ./x.py install --target=$triple std
done
# The rls stub doesn't have an install target, but we can just copy it.
%{__install} -t %{buildroot}%{_bindir} build/%{rust_triple}/stage2-tools-bin/rls
# These are transient files used by x.py dist and install
rm -rf ./build/dist/ ./build/tmp/
@ -856,16 +847,13 @@ rm -f %{buildroot}%{rustlibdir}/etc/lldb_*
# We don't want Rust copies of LLVM tools (rust-lld, rust-llvm-dwp)
rm -f %{buildroot}%{rustlibdir}/%{rust_triple}/bin/rust-ll*
%if 0%{?rhel}
%if 0%{?rhel} && 0%{?rhel} >= 8
# This allows users to build packages using Rust Toolset.
%{__install} -D -m 644 %{S:100} %{buildroot}%{rpmmacrodir}/macros.rust-toolset
%endif
%check
%if 0%{?rhel} && 0%{?rhel} <= 9
%{?set_build_flags}
%endif
%{export_rust_env}
# Sanity-check the installed binaries, debuginfo-stripped and all.
@ -883,17 +871,20 @@ done
# The results are not stable on koji, so mask errors and just log it.
# Some of the larger test artifacts are manually cleaned to save space.
%{__python3} ./x.py test --no-fail-fast || :
%{__python3} ./x.py test --no-fail-fast --stage 2 || :
rm -rf "./build/%{rust_triple}/test/"
%{__python3} ./x.py test --no-fail-fast cargo || :
%{__python3} ./x.py test --no-fail-fast --stage 2 cargo || :
rm -rf "./build/%{rust_triple}/stage2-tools/%{rust_triple}/cit/"
%{__python3} ./x.py test --no-fail-fast clippy || :
%{__python3} ./x.py test --no-fail-fast --stage 2 clippy || :
%{__python3} ./x.py test --no-fail-fast rust-analyzer || :
env RLS_TEST_WAIT_FOR_AGES=1 \
%{__python3} ./x.py test --no-fail-fast --stage 2 rls || :
%{__python3} ./x.py test --no-fail-fast rustfmt || :
%{__python3} ./x.py test --no-fail-fast --stage 2 rust-analyzer || :
%{__python3} ./x.py test --no-fail-fast --stage 2 rustfmt || :
%ldconfig_scriptlets
@ -997,15 +988,20 @@ end}
%files doc
%docdir %{_docdir}/%{name}
%dir %{_docdir}/%{name}
%{_docdir}/%{name}/html
# former cargo-doc
%docdir %{_docdir}/cargo
%dir %{_docdir}/cargo
%{_docdir}/cargo/html
%dir %{_docdir}/%{name}/html
%{_docdir}/%{name}/html/*/
%{_docdir}/%{name}/html/*.html
%{_docdir}/%{name}/html/*.css
%{_docdir}/%{name}/html/*.js
%{_docdir}/%{name}/html/*.png
%{_docdir}/%{name}/html/*.svg
%{_docdir}/%{name}/html/*.woff2
%license %{_docdir}/%{name}/html/*.txt
%license %{_docdir}/%{name}/html/*.md
%files -n cargo
%license src/tools/cargo/LICENSE-{APACHE,MIT,THIRD-PARTY}
%license src/tools/cargo/LICENSE-APACHE src/tools/cargo/LICENSE-MIT src/tools/cargo/LICENSE-THIRD-PARTY
%doc src/tools/cargo/README.md
%{_bindir}/cargo
%{_libexecdir}/cargo*
@ -1016,6 +1012,12 @@ end}
%dir %{_datadir}/cargo/registry
%files -n cargo-doc
%docdir %{_docdir}/cargo
%dir %{_docdir}/cargo
%{_docdir}/cargo/html
%files -n rustfmt
%{_bindir}/rustfmt
%{_bindir}/cargo-fmt
@ -1023,9 +1025,16 @@ end}
%license src/tools/rustfmt/LICENSE-{APACHE,MIT}
%files analyzer
%files -n rls
%{_bindir}/rls
%doc src/tools/rls/{README.md,COPYRIGHT,debugging.md}
%license src/tools/rls/LICENSE-{APACHE,MIT}
%files analyzer
%ifnarch riscv64
%{_bindir}/rust-analyzer
%endif
%doc src/tools/rust-analyzer/README.md
%license src/tools/rust-analyzer/LICENSE-{APACHE,MIT}
@ -1042,67 +1051,25 @@ end}
%{rustlibdir}/src
%if 0%{?rhel}
%files analysis
%{rustlibdir}/%{rust_triple}/analysis/
%if 0%{?rhel} && 0%{?rhel} >= 8
%files toolset
%{rpmmacrodir}/macros.rust-toolset
%endif
%changelog
* Thu Jun 01 2023 Josh Stone <jistone@redhat.com> - 1.70.0-1
- Update to 1.70.0.
* Sun Nov 27 2022 David Abdurachmanov <davidlt@rivosinc.com> - 1.64.0-1.2.riscv64
- Do not package rust-analyzer
* Fri May 05 2023 Josh Stone <jistone@redhat.com> - 1.69.0-3
- Fix debuginfo with LLVM 16
* Sat Nov 26 2022 David Abdurachmanov <davidlt@rivosinc.com> - 1.64.0-1.1.riscv64
- Revert 263edd43c5255084292329423c61a9d69715ebfa
* Mon May 01 2023 Josh Stone <jistone@redhat.com> - 1.69.0-2
- Build with LLVM 15 on Fedora 38+
* Thu Apr 20 2023 Josh Stone <jistone@redhat.com> - 1.69.0-1
- Update to 1.69.0.
- Obsolete rust-analysis.
* Tue Mar 28 2023 Josh Stone <jistone@redhat.com> - 1.68.2-1
- Update to 1.68.2.
* Thu Mar 23 2023 Josh Stone <jistone@redhat.com> - 1.68.1-1
- Update to 1.68.1.
* Thu Mar 09 2023 Josh Stone <jistone@redhat.com> - 1.68.0-1
- Update to 1.68.0.
* Tue Mar 07 2023 David Michael <fedora.dm0@gmail.com> - 1.67.1-3
- Add a virtual Provides to rust-std-static containing the target triple.
* Mon Feb 20 2023 Orion Poplawski <orion@nwra.com> - 1.67.1-2
- Ship rust-toolset for EPEL7
* Thu Feb 09 2023 Josh Stone <jistone@redhat.com> - 1.67.1-1
- Update to 1.67.1.
* Fri Feb 03 2023 Josh Stone <jistone@redhat.com> - 1.67.0-3
- Unbundle libgit2 on Fedora 38.
* Fri Jan 27 2023 Adam Williamson <awilliam@redhat.com> - 1.67.0-2
- Backport PR #107360 to fix build of mesa
- Backport 675fa0b3 to fix bootstrapping failure
* Thu Jan 26 2023 Josh Stone <jistone@redhat.com> - 1.67.0-1
- Update to 1.67.0.
* Fri Jan 20 2023 Fedora Release Engineering <releng@fedoraproject.org> - 1.66.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
* Tue Jan 10 2023 Josh Stone <jistone@redhat.com> - 1.66.1-1
- Update to 1.66.1.
- Security fix for CVE-2022-46176
* Thu Dec 15 2022 Josh Stone <jistone@redhat.com> - 1.66.0-1
- Update to 1.66.0.
* Thu Nov 03 2022 Josh Stone <jistone@redhat.com> - 1.65.0-1
- Update to 1.65.0.
- rust-analyzer now obsoletes rls.
* Fri Nov 04 2022 David Abdurachmanov <davidlt@rivosinc.com> - 1.64.0-1.0.riscv64
- Enable riscv64
* Thu Sep 22 2022 Josh Stone <jistone@redhat.com> - 1.64.0-1
- Update to 1.64.0.

View File

@ -0,0 +1,42 @@
--- rustc-1.59.0-src/Cargo.lock.orig 2022-02-21 18:48:37.000000000 -0800
+++ rustc-1.59.0-src/Cargo.lock 2022-02-22 10:16:10.381962862 -0800
@@ -1935,7 +1935,6 @@
dependencies = [
"cc",
"libc",
- "libssh2-sys",
"libz-sys",
"openssl-sys",
"pkg-config",
@@ -1968,20 +1967,6 @@
]
[[package]]
-name = "libssh2-sys"
-version = "0.2.23"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b094a36eb4b8b8c8a7b4b8ae43b2944502be3e59cd87687595cf6b0a71b3f4ca"
-dependencies = [
- "cc",
- "libc",
- "libz-sys",
- "openssl-sys",
- "pkg-config",
- "vcpkg",
-]
-
-[[package]]
name = "libz-sys"
version = "1.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
--- rustc-1.59.0-src/vendor/git2/Cargo.toml.orig 2022-02-21 20:14:37.000000000 -0800
+++ rustc-1.59.0-src/vendor/git2/Cargo.toml 2022-02-22 10:12:23.021772490 -0800
@@ -51,7 +51,7 @@
version = "0.1.39"
[features]
-default = ["ssh", "https", "ssh_key_from_memory"]
+default = ["https"]
https = ["libgit2-sys/https", "openssl-sys", "openssl-probe"]
ssh = ["libgit2-sys/ssh"]
ssh_key_from_memory = ["libgit2-sys/ssh_key_from_memory"]

View File

@ -0,0 +1,18 @@
--- rustc-1.61.0-src/src/etc/rust-gdb.orig 2022-05-17 18:29:36.000000000 -0700
+++ rustc-1.61.0-src/src/etc/rust-gdb 2022-05-18 11:18:13.732709661 -0700
@@ -14,6 +14,9 @@ fi
RUSTC_SYSROOT="$("$RUSTC" --print=sysroot)"
GDB_PYTHON_MODULE_DIRECTORY="$RUSTC_SYSROOT/lib/rustlib/etc"
+RUST_STD_BUILD="@BUILDDIR@/library/"
+RUST_STD_SRC="$RUSTC_SYSROOT/lib/rustlib/src/rust/library/"
+
# Run GDB with the additional arguments that load the pretty printers
# Set the environment variable `RUST_GDB` to overwrite the call to a
# different/specific command (defaults to `gdb`).
@@ -21,4 +24,5 @@ RUST_GDB="${RUST_GDB:-gdb}"
PYTHONPATH="$PYTHONPATH:$GDB_PYTHON_MODULE_DIRECTORY" exec ${RUST_GDB} \
--directory="$GDB_PYTHON_MODULE_DIRECTORY" \
-iex "add-auto-load-safe-path $GDB_PYTHON_MODULE_DIRECTORY" \
+ -iex "set substitute-path $RUST_STD_BUILD $RUST_STD_SRC" \
"$@"

View File

@ -1,6 +1,6 @@
--- rustc-beta-src/Cargo.lock.orig 2023-05-24 16:49:05.242510531 -0700
+++ rustc-beta-src/Cargo.lock 2023-05-24 16:51:11.741865603 -0700
@@ -1197,7 +1197,6 @@ checksum = "14d05c10f541ae6f3bc5b3d923c2
--- rustc-1.63.0-src/Cargo.lock.orig 2022-08-10 12:25:16.512185135 -0700
+++ rustc-1.63.0-src/Cargo.lock 2022-08-10 12:25:16.513185114 -0700
@@ -1054,7 +1054,6 @@
dependencies = [
"cc",
"libc",
@ -8,7 +8,7 @@
"libz-sys",
"openssl-sys",
"pkg-config",
@@ -2989,16 +2988,6 @@ source = "registry+https://github.com/ru
@@ -2160,16 +2159,6 @@
checksum = "7fc7aa29613bd6a620df431842069224d8bc9011086b1db4c0e0cd47fa03ec9a"
[[package]]
@ -25,20 +25,41 @@
name = "libz-sys"
version = "1.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
--- rustc-beta-src/src/tools/cargo/Cargo.toml.orig 2023-05-24 16:49:05.244510489 -0700
+++ rustc-beta-src/src/tools/cargo/Cargo.toml 2023-05-24 16:51:04.683013189 -0700
@@ -23,7 +23,7 @@ cargo-platform = { path = "crates/cargo-
cargo-util = { path = "crates/cargo-util", version = "0.2.4" }
clap = "4.2.0"
crates-io = { path = "crates/crates-io", version = "0.36.0" }
-curl = { version = "0.4.44", features = ["http2"] }
+curl = { version = "0.4.44", features = [] }
curl-sys = "0.4.61"
env_logger = "0.10.0"
filetime = "0.2.9"
--- rustc-beta-src/src/tools/cargo/src/cargo/core/package.rs.orig 2023-05-19 19:05:42.000000000 -0700
+++ rustc-beta-src/src/tools/cargo/src/cargo/core/package.rs 2023-05-24 16:49:05.244510489 -0700
@@ -407,16 +407,9 @@ impl<'cfg> PackageSet<'cfg> {
--- rustc-1.63.0-src/src/tools/cargo/Cargo.toml.orig 2022-08-10 12:25:16.514185093 -0700
+++ rustc-1.63.0-src/src/tools/cargo/Cargo.toml 2022-08-10 12:25:51.441455282 -0700
@@ -22,7 +22,7 @@
cargo-util = { path = "crates/cargo-util", version = "0.2.1" }
crates-io = { path = "crates/crates-io", version = "0.34.0" }
crossbeam-utils = "0.8"
-curl = { version = "0.4.43", features = ["http2"] }
+curl = { version = "0.4.43", features = [] }
curl-sys = "0.4.55"
env_logger = "0.9.0"
pretty_env_logger = { version = "0.4", optional = true }
--- rustc-1.63.0-src/src/tools/cargo/src/cargo/sources/registry/http_remote.rs.orig 2022-08-08 15:47:35.000000000 -0700
+++ rustc-1.63.0-src/src/tools/cargo/src/cargo/sources/registry/http_remote.rs 2022-08-10 12:25:16.514185093 -0700
@@ -192,16 +192,8 @@
}
self.fetch_started = true;
- // We've enabled the `http2` feature of `curl` in Cargo, so treat
- // failures here as fatal as it would indicate a build-time problem.
- self.multiplexing = self.config.http_config()?.multiplexing.unwrap_or(true);
-
- self.multi
- .pipelining(false, self.multiplexing)
- .with_context(|| "failed to enable multiplexing/pipelining in curl")?;
-
- // let's not flood the server with connections
- self.multi.set_max_host_connections(2)?;
+ // Multiplexing is disabled because the system libcurl doesn't support it.
+ self.multiplexing = false;
self.config
.shell()
--- rustc-1.63.0-src/src/tools/cargo/src/cargo/core/package.rs.orig 2022-08-08 15:47:35.000000000 -0700
+++ rustc-1.63.0-src/src/tools/cargo/src/cargo/core/package.rs 2022-08-10 12:25:16.514185093 -0700
@@ -403,16 +403,9 @@
sources: SourceMap<'cfg>,
config: &'cfg Config,
) -> CargoResult<PackageSet<'cfg>> {
@ -58,30 +79,7 @@
Ok(PackageSet {
packages: package_ids
--- rustc-beta-src/src/tools/cargo/src/cargo/sources/registry/http_remote.rs.orig 2023-05-24 16:49:05.245510468 -0700
+++ rustc-beta-src/src/tools/cargo/src/cargo/sources/registry/http_remote.rs 2023-05-24 16:51:57.916900146 -0700
@@ -229,16 +229,8 @@ impl<'cfg> HttpRegistry<'cfg> {
}
self.fetch_started = true;
- // We've enabled the `http2` feature of `curl` in Cargo, so treat
- // failures here as fatal as it would indicate a build-time problem.
- self.multiplexing = self.config.http_config()?.multiplexing.unwrap_or(true);
-
- self.multi
- .pipelining(false, self.multiplexing)
- .with_context(|| "failed to enable multiplexing/pipelining in curl")?;
-
- // let's not flood the server with connections
- self.multi.set_max_host_connections(2)?;
+ // Multiplexing is disabled because the system libcurl doesn't support it.
+ self.multiplexing = false;
if !self.quiet {
self.config
--- rustc-beta-src/src/tools/cargo/src/cargo/util/network/mod.rs.orig 2023-05-19 19:05:42.000000000 -0700
+++ rustc-beta-src/src/tools/cargo/src/cargo/util/network/mod.rs 2023-05-24 16:49:05.245510468 -0700
@@ -25,7 +25,7 @@ impl<T> PollExt<T> for Poll<T> {
@@ -658,7 +651,7 @@
macro_rules! try_old_curl {
($e:expr, $msg:expr) => {
let result = $e;

View File

@ -0,0 +1,45 @@
diff --git a/compiler/rustc_codegen_ssa/src/back/link.rs b/compiler/rustc_codegen_ssa/src/back/link.rs
index 63207803e327..f5757760c409 100644
--- a/compiler/rustc_codegen_ssa/src/back/link.rs
+++ b/compiler/rustc_codegen_ssa/src/back/link.rs
@@ -741,7 +741,7 @@ fn link_natively<'a>(
&& cmd.get_args().iter().any(|e| e.to_string_lossy() == "-no-pie")
{
info!("linker output: {:?}", out);
- warn!("Linker does not support -no-pie command line option. Retrying without.");
+ info!("Linker does not support -no-pie command line option. Retrying without.");
for arg in cmd.take_args() {
if arg.to_string_lossy() != "-no-pie" {
cmd.arg(arg);
@@ -760,7 +760,7 @@ fn link_natively<'a>(
&& cmd.get_args().iter().any(|e| e.to_string_lossy() == "-static-pie")
{
info!("linker output: {:?}", out);
- warn!(
+ info!(
"Linker does not support -static-pie command line option. Retrying with -static instead."
);
// Mirror `add_(pre,post)_link_objects` to replace CRT objects.
@@ -1507,15 +1507,15 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
}
fn link_output_kind(sess: &Session, crate_type: CrateType) -> LinkOutputKind {
- let kind = match (crate_type, sess.crt_static(Some(crate_type)), sess.relocation_model()) {
+ // Only use PIE if explicitly specified.
+ #[cfg_attr(not(bootstrap), allow(rustc::bad_opt_access))]
+ let explicit_pic =
+ matches!(sess.opts.cg.relocation_model, Some(RelocModel::Pic | RelocModel::Pie));
+ let kind = match (crate_type, sess.crt_static(Some(crate_type)), explicit_pic) {
(CrateType::Executable, _, _) if sess.is_wasi_reactor() => LinkOutputKind::WasiReactorExe,
- (CrateType::Executable, false, RelocModel::Pic | RelocModel::Pie) => {
- LinkOutputKind::DynamicPicExe
- }
+ (CrateType::Executable, false, true) => LinkOutputKind::DynamicPicExe,
(CrateType::Executable, false, _) => LinkOutputKind::DynamicNoPicExe,
- (CrateType::Executable, true, RelocModel::Pic | RelocModel::Pie) => {
- LinkOutputKind::StaticPicExe
- }
+ (CrateType::Executable, true, true) => LinkOutputKind::StaticPicExe,
(CrateType::Executable, true, _) => LinkOutputKind::StaticNoPicExe,
(_, true, _) => LinkOutputKind::StaticDylib,
(_, false, _) => LinkOutputKind::DynamicDylib,

View File

@ -1,43 +0,0 @@
--- rustc-beta-src/Cargo.lock.orig 2023-05-19 19:02:31.000000000 -0700
+++ rustc-beta-src/Cargo.lock 2023-05-24 16:36:33.312232441 -0700
@@ -2967,7 +2967,6 @@
dependencies = [
"cc",
"libc",
- "libssh2-sys",
"libz-sys",
"openssl-sys",
"pkg-config",
@@ -3000,20 +2999,6 @@
]
[[package]]
-name = "libssh2-sys"
-version = "0.3.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2dc8a030b787e2119a731f1951d6a773e2280c660f8ec4b0f5e1505a386e71ee"
-dependencies = [
- "cc",
- "libc",
- "libz-sys",
- "openssl-sys",
- "pkg-config",
- "vcpkg",
-]
-
-[[package]]
name = "libz-sys"
version = "1.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
--- rustc-beta-src/vendor/git2/Cargo.toml.orig 2023-05-19 21:16:57.000000000 -0700
+++ rustc-beta-src/vendor/git2/Cargo.toml 2023-05-24 16:33:42.043813439 -0700
@@ -55,9 +55,7 @@
[features]
default = [
- "ssh",
"https",
- "ssh_key_from_memory",
]
https = [
"libgit2-sys/https",

View File

@ -1,21 +0,0 @@
diff --git a/src/etc/rust-gdb b/src/etc/rust-gdb
index 9abed30ea6f7..e4bf55df3688 100755
--- a/src/etc/rust-gdb
+++ b/src/etc/rust-gdb
@@ -13,8 +13,6 @@ fi
# Find out where the pretty printer Python module is
RUSTC_SYSROOT="$("$RUSTC" --print=sysroot)"
GDB_PYTHON_MODULE_DIRECTORY="$RUSTC_SYSROOT/lib/rustlib/etc"
-# Get the commit hash for path remapping
-RUSTC_COMMIT_HASH="$("$RUSTC" -vV | sed -n 's/commit-hash: \([a-zA-Z0-9_]*\)/\1/p')"
# Run GDB with the additional arguments that load the pretty printers
# Set the environment variable `RUST_GDB` to overwrite the call to a
@@ -23,6 +21,6 @@ RUST_GDB="${RUST_GDB:-gdb}"
PYTHONPATH="$PYTHONPATH:$GDB_PYTHON_MODULE_DIRECTORY" exec ${RUST_GDB} \
--directory="$GDB_PYTHON_MODULE_DIRECTORY" \
-iex "add-auto-load-safe-path $GDB_PYTHON_MODULE_DIRECTORY" \
- -iex "set substitute-path /rustc/$RUSTC_COMMIT_HASH $RUSTC_SYSROOT/lib/rustlib/src/rust" \
+ -iex "set substitute-path @BUILDDIR@ $RUSTC_SYSROOT/lib/rustlib/src/rust" \
"$@"

View File

@ -1,2 +1,2 @@
SHA512 (rustc-1.70.0-src.tar.xz) = 21b35185fdcc35a059ee5ef6dca2b68f5f1d199e97f425a571cfc318a852c36a57bccf68e7673b4cb7cd83128f30d0b3eb93009a978f3ba3909b7eee50d40631
SHA512 (wasi-libc-wasi-sdk-20.tar.gz) = e264240dc7dbcf6398c8ca09bc108298f4a8aa955af22de5a3015fbcde81cb09dd83cd48349090082d5de0e8a3dbcf746c7b14657c67657b3f2f1ab28bb9cf05
SHA512 (rustc-1.64.0-src.tar.xz) = 919f40acd8c6eaaef399aa3248503bea19feb96697ab221aaede9ee789ce340b47cb899d1e0e41a31e5d7756653968a10d2faaa4aee83294c9f1243949b43516
SHA512 (wasi-libc-9886d3d6200fcc3726329966860fc058707406cd.tar.gz) = 5b6af0f7133d31c2c068606737eff957126a3045e09c1e95bd2650e0c5637d4797d7036b9beb167829d38d58f6d4199852832f61b0c8836f05e945cd0cf68132

View File

@ -48,10 +48,7 @@ rlJournalStart
rlRun "rpm -ivh $SRPM"
rlRun SPECDIR="$(rpm -E '%{_specdir}')"
# librsvg2 contains dynamic dependencies. builddep needs to be run
# from the srpm (not the spec file) to be able to generate them:
# https://fedoraproject.org/wiki/Changes/DynamicBuildRequires#rpmbuild
rlRun "yum-builddep -y ${SRPM} ${YUM_SWITCHES}"
rlRun "yum-builddep -y ${SPECDIR}/${PKG_TO_BUILD}.spec ${YUM_SWITCHES}"
rlPhaseEnd
rlPhaseStartTest