Auto merge of #145890 - GuillaumeGomez:subtree-update_cg_gcc_2025-08-26, r=GuillaumeGomez
GCC backend subtree update
cc `@antoyo`
r? ghost
diff --git a/compiler/rustc_codegen_llvm/src/llvm/ffi.rs b/compiler/rustc_codegen_llvm/src/llvm/ffi.rs
index fa2802a..7c79cba 100644
--- a/compiler/rustc_codegen_llvm/src/llvm/ffi.rs
+++ b/compiler/rustc_codegen_llvm/src/llvm/ffi.rs
@@ -1929,11 +1929,17 @@ pub(crate) fn LLVMRustCreateMemoryEffectsAttr(
C: &Context,
effects: MemoryEffects,
) -> &Attribute;
+ /// ## Safety
+ /// - Each of `LowerWords` and `UpperWords` must point to an array that is
+ /// long enough to fully define an integer of size `NumBits`, i.e. each
+ /// pointer must point to `NumBits.div_ceil(64)` elements or more.
+ /// - The implementation will make its own copy of the pointed-to `u64`
+ /// values, so the pointers only need to outlive this function call.
pub(crate) fn LLVMRustCreateRangeAttribute(
C: &Context,
- num_bits: c_uint,
- lower_words: *const u64,
- upper_words: *const u64,
+ NumBits: c_uint,
+ LowerWords: *const u64,
+ UpperWords: *const u64,
) -> &Attribute;
// Operations on functions
diff --git a/compiler/rustc_codegen_llvm/src/llvm/mod.rs b/compiler/rustc_codegen_llvm/src/llvm/mod.rs
index 6adabe5..d6974e2 100644
--- a/compiler/rustc_codegen_llvm/src/llvm/mod.rs
+++ b/compiler/rustc_codegen_llvm/src/llvm/mod.rs
@@ -112,16 +112,26 @@ pub(crate) fn CreateAllocKindAttr(llcx: &Context, kind_arg: AllocKindFlags) -> &
pub(crate) fn CreateRangeAttr(llcx: &Context, size: Size, range: WrappingRange) -> &Attribute {
let lower = range.start;
+ // LLVM treats the upper bound as exclusive, but allows wrapping.
let upper = range.end.wrapping_add(1);
- let lower_words = [lower as u64, (lower >> 64) as u64];
- let upper_words = [upper as u64, (upper >> 64) as u64];
+
+ // Pass each `u128` endpoint value as a `[u64; 2]` array, least-significant part first.
+ let as_u64_array = |x: u128| [x as u64, (x >> 64) as u64];
+ let lower_words: [u64; 2] = as_u64_array(lower);
+ let upper_words: [u64; 2] = as_u64_array(upper);
+
+ // To ensure that LLVM doesn't try to read beyond the `[u64; 2]` arrays,
+ // we must explicitly check that `size_bits` does not exceed 128.
+ let size_bits = size.bits();
+ assert!(size_bits <= 128);
+ // More robust assertions that are redundant with `size_bits <= 128` and
+ // should be optimized away.
+ assert!(size_bits.div_ceil(64) <= u64::try_from(lower_words.len()).unwrap());
+ assert!(size_bits.div_ceil(64) <= u64::try_from(upper_words.len()).unwrap());
+ let size_bits = c_uint::try_from(size_bits).unwrap();
+
unsafe {
- LLVMRustCreateRangeAttribute(
- llcx,
- size.bits().try_into().unwrap(),
- lower_words.as_ptr(),
- upper_words.as_ptr(),
- )
+ LLVMRustCreateRangeAttribute(llcx, size_bits, lower_words.as_ptr(), upper_words.as_ptr())
}
}
diff --git a/compiler/rustc_codegen_llvm/src/llvm_util.rs b/compiler/rustc_codegen_llvm/src/llvm_util.rs
index d5025bb..d927ffd 100644
--- a/compiler/rustc_codegen_llvm/src/llvm_util.rs
+++ b/compiler/rustc_codegen_llvm/src/llvm_util.rs
@@ -279,7 +279,7 @@ pub(crate) fn to_llvm_features<'a>(sess: &Session, s: &'a str) -> Option<LLVMFea
}
("loongarch32" | "loongarch64", "32s") if get_version().0 < 21 => None,
// Filter out features that are not supported by the current LLVM version
- ("riscv32" | "riscv64", "zacas") if get_version().0 < 20 => None,
+ ("riscv32" | "riscv64", "zacas" | "rva23u64" | "supm") if get_version().0 < 20 => None,
(
"s390x",
"message-security-assist-extension12"
diff --git a/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp b/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
index e699e4b..cce40da 100644
--- a/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
+++ b/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
@@ -488,6 +488,9 @@
LLVMRustCreateRangeAttribute(LLVMContextRef C, unsigned NumBits,
const uint64_t LowerWords[],
const uint64_t UpperWords[]) {
+ // FIXME(Zalathar): There appears to be no stable guarantee that C++
+ // `AttrKind` values correspond directly to the `unsigned KindID` values
+ // accepted by LLVM-C API functions, though in practice they currently do.
return LLVMCreateConstantRangeAttribute(C, Attribute::Range, NumBits,
LowerWords, UpperWords);
}
diff --git a/compiler/rustc_target/src/spec/mod.rs b/compiler/rustc_target/src/spec/mod.rs
index a67795e..c53d92b 100644
--- a/compiler/rustc_target/src/spec/mod.rs
+++ b/compiler/rustc_target/src/spec/mod.rs
@@ -1954,6 +1954,7 @@ fn $module() {
("armv7-unknown-linux-musleabihf", armv7_unknown_linux_musleabihf),
("aarch64-unknown-linux-gnu", aarch64_unknown_linux_gnu),
("aarch64-unknown-linux-musl", aarch64_unknown_linux_musl),
+ ("aarch64_be-unknown-linux-musl", aarch64_be_unknown_linux_musl),
("x86_64-unknown-linux-musl", x86_64_unknown_linux_musl),
("i686-unknown-linux-musl", i686_unknown_linux_musl),
("i586-unknown-linux-musl", i586_unknown_linux_musl),
@@ -2149,6 +2150,7 @@ fn $module() {
("riscv64gc-unknown-none-elf", riscv64gc_unknown_none_elf),
("riscv64gc-unknown-linux-gnu", riscv64gc_unknown_linux_gnu),
("riscv64gc-unknown-linux-musl", riscv64gc_unknown_linux_musl),
+ ("riscv64a23-unknown-linux-gnu", riscv64a23_unknown_linux_gnu),
("sparc-unknown-none-elf", sparc_unknown_none_elf),
diff --git a/compiler/rustc_target/src/spec/targets/aarch64_be_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/aarch64_be_unknown_linux_musl.rs
new file mode 100644
index 0000000..be5ac4a
--- /dev/null
+++ b/compiler/rustc_target/src/spec/targets/aarch64_be_unknown_linux_musl.rs
@@ -0,0 +1,40 @@
+use rustc_abi::Endian;
+
+use crate::spec::{
+ FramePointer, SanitizerSet, StackProbeType, Target, TargetMetadata, TargetOptions, base,
+};
+
+pub(crate) fn target() -> Target {
+ let mut base = base::linux_musl::opts();
+ base.max_atomic_width = Some(128);
+ base.supports_xray = true;
+ base.features = "+v8a,+outline-atomics".into();
+ base.stack_probes = StackProbeType::Inline;
+ base.supported_sanitizers = SanitizerSet::ADDRESS
+ | SanitizerSet::CFI
+ | SanitizerSet::LEAK
+ | SanitizerSet::MEMORY
+ | SanitizerSet::THREAD;
+
+ Target {
+ llvm_target: "aarch64_be-unknown-linux-musl".into(),
+ metadata: TargetMetadata {
+ description: Some("ARM64 Linux (big-endian) with musl-libc 1.2.5".into()),
+ tier: Some(3),
+ host_tools: Some(false),
+ std: Some(true),
+ },
+ pointer_width: 64,
+ data_layout: "E-m:e-p270:32:32-p271:32:32-p272:64:64-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128-Fn32".into(),
+ arch: "aarch64".into(),
+ options: TargetOptions {
+ // the AAPCS64 expects use of non-leaf frame pointers per
+ // https://github.com/ARM-software/abi-aa/blob/4492d1570eb70c8fd146623e0db65b2d241f12e7/aapcs64/aapcs64.rst#the-frame-pointer
+ // and we tend to encounter interesting bugs in AArch64 unwinding code if we do not
+ frame_pointer: FramePointer::NonLeaf,
+ mcount: "\u{1}_mcount".into(),
+ endian: Endian::Big,
+ ..base
+ },
+ }
+}
diff --git a/compiler/rustc_target/src/spec/targets/riscv64a23_unknown_linux_gnu.rs b/compiler/rustc_target/src/spec/targets/riscv64a23_unknown_linux_gnu.rs
new file mode 100644
index 0000000..60f2e7d
--- /dev/null
+++ b/compiler/rustc_target/src/spec/targets/riscv64a23_unknown_linux_gnu.rs
@@ -0,0 +1,27 @@
+use std::borrow::Cow;
+
+use crate::spec::{CodeModel, SplitDebuginfo, Target, TargetMetadata, TargetOptions, base};
+
+pub(crate) fn target() -> Target {
+ Target {
+ llvm_target: "riscv64-unknown-linux-gnu".into(),
+ metadata: TargetMetadata {
+ description: Some("RISC-V Linux (kernel 6.8.0, glibc 2.39)".into()),
+ tier: Some(3),
+ host_tools: Some(true),
+ std: Some(true),
+ },
+ pointer_width: 64,
+ data_layout: "e-m:e-p:64:64-i64:64-i128:128-n32:64-S128".into(),
+ arch: "riscv64".into(),
+ options: TargetOptions {
+ code_model: Some(CodeModel::Medium),
+ cpu: "generic-rv64".into(),
+ features: "+rva23u64".into(),
+ llvm_abiname: "lp64d".into(),
+ max_atomic_width: Some(64),
+ supported_split_debuginfo: Cow::Borrowed(&[SplitDebuginfo::Off]),
+ ..base::linux_gnu::opts()
+ },
+ }
+}
diff --git a/compiler/rustc_target/src/target_features.rs b/compiler/rustc_target/src/target_features.rs
index e45300b..4c1b8c9 100644
--- a/compiler/rustc_target/src/target_features.rs
+++ b/compiler/rustc_target/src/target_features.rs
@@ -601,6 +601,49 @@ pub fn toggle_allowed(&self) -> Result<(), &'static str> {
),
("m", Stable, &[]),
("relax", Unstable(sym::riscv_target_feature), &[]),
+ (
+ "rva23u64",
+ Unstable(sym::riscv_target_feature),
+ &[
+ "m",
+ "a",
+ "f",
+ "d",
+ "c",
+ "b",
+ "v",
+ "zicsr",
+ "zicntr",
+ "zihpm",
+ "ziccif",
+ "ziccrse",
+ "ziccamoa",
+ "zicclsm",
+ "zic64b",
+ "za64rs",
+ "zihintpause",
+ "zba",
+ "zbb",
+ "zbs",
+ "zicbom",
+ "zicbop",
+ "zicboz",
+ "zfhmin",
+ "zkt",
+ "zvfhmin",
+ "zvbb",
+ "zvkt",
+ "zihintntl",
+ "zicond",
+ "zimop",
+ "zcmop",
+ "zcb",
+ "zfa",
+ "zawrs",
+ "supm",
+ ],
+ ),
+ ("supm", Unstable(sym::riscv_target_feature), &[]),
("unaligned-scalar-mem", Unstable(sym::riscv_target_feature), &[]),
("unaligned-vector-mem", Unstable(sym::riscv_target_feature), &[]),
("v", Unstable(sym::riscv_target_feature), &["zvl128b", "zve64d"]),
diff --git a/compiler/rustc_thread_pool/src/lib.rs b/compiler/rustc_thread_pool/src/lib.rs
index 34252d9..7ce7fbc 100644
--- a/compiler/rustc_thread_pool/src/lib.rs
+++ b/compiler/rustc_thread_pool/src/lib.rs
@@ -787,18 +787,7 @@ fn is_unsupported(&self) -> bool {
}
}
-const GLOBAL_POOL_ALREADY_INITIALIZED: &str =
- "The global thread pool has already been initialized.";
-
impl Error for ThreadPoolBuildError {
- #[allow(deprecated)]
- fn description(&self) -> &str {
- match self.kind {
- ErrorKind::GlobalPoolAlreadyInitialized => GLOBAL_POOL_ALREADY_INITIALIZED,
- ErrorKind::IOError(ref e) => e.description(),
- }
- }
-
fn source(&self) -> Option<&(dyn Error + 'static)> {
match &self.kind {
ErrorKind::GlobalPoolAlreadyInitialized => None,
@@ -810,7 +799,9 @@ fn source(&self) -> Option<&(dyn Error + 'static)> {
impl fmt::Display for ThreadPoolBuildError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match &self.kind {
- ErrorKind::GlobalPoolAlreadyInitialized => GLOBAL_POOL_ALREADY_INITIALIZED.fmt(f),
+ ErrorKind::GlobalPoolAlreadyInitialized => {
+ "The global thread pool has already been initialized.".fmt(f)
+ }
ErrorKind::IOError(e) => e.fmt(f),
}
}
diff --git a/compiler/rustc_trait_selection/src/error_reporting/traits/suggestions.rs b/compiler/rustc_trait_selection/src/error_reporting/traits/suggestions.rs
index e31ff8b..aa153d3 100644
--- a/compiler/rustc_trait_selection/src/error_reporting/traits/suggestions.rs
+++ b/compiler/rustc_trait_selection/src/error_reporting/traits/suggestions.rs
@@ -820,16 +820,20 @@ pub(super) fn suggest_fn_call(
if matches!(obligation.cause.code(), ObligationCauseCode::FunctionArg { .. })
&& obligation.cause.span.can_be_used_for_suggestions()
{
+ let (span, sugg) = if let Some(snippet) =
+ self.tcx.sess.source_map().span_to_snippet(obligation.cause.span).ok()
+ && snippet.starts_with("|")
+ {
+ (obligation.cause.span, format!("({snippet})({args})"))
+ } else {
+ (obligation.cause.span.shrink_to_hi(), format!("({args})"))
+ };
+
// When the obligation error has been ensured to have been caused by
// an argument, the `obligation.cause.span` points at the expression
// of the argument, so we can provide a suggestion. Otherwise, we give
// a more general note.
- err.span_suggestion_verbose(
- obligation.cause.span.shrink_to_hi(),
- msg,
- format!("({args})"),
- Applicability::HasPlaceholders,
- );
+ err.span_suggestion_verbose(span, msg, sugg, Applicability::HasPlaceholders);
} else if let DefIdOrName::DefId(def_id) = def_id_or_name {
let name = match self.tcx.hir_get_if_local(def_id) {
Some(hir::Node::Expr(hir::Expr {
diff --git a/library/alloc/src/boxed.rs b/library/alloc/src/boxed.rs
index fa12d37..98c9f6b5 100644
--- a/library/alloc/src/boxed.rs
+++ b/library/alloc/src/boxed.rs
@@ -2128,11 +2128,6 @@ fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
#[stable(feature = "box_error", since = "1.8.0")]
impl<E: Error> Error for Box<E> {
- #[allow(deprecated, deprecated_in_future)]
- fn description(&self) -> &str {
- Error::description(&**self)
- }
-
#[allow(deprecated)]
fn cause(&self) -> Option<&dyn Error> {
Error::cause(&**self)
diff --git a/library/alloc/src/boxed/convert.rs b/library/alloc/src/boxed/convert.rs
index 8062658..45c46fb 100644
--- a/library/alloc/src/boxed/convert.rs
+++ b/library/alloc/src/boxed/convert.rs
@@ -608,12 +608,7 @@ impl<'a> From<String> for Box<dyn Error + Send + Sync + 'a> {
fn from(err: String) -> Box<dyn Error + Send + Sync + 'a> {
struct StringError(String);
- impl Error for StringError {
- #[allow(deprecated)]
- fn description(&self) -> &str {
- &self.0
- }
- }
+ impl Error for StringError {}
impl fmt::Display for StringError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
diff --git a/library/alloc/src/collections/btree/map/entry.rs b/library/alloc/src/collections/btree/map/entry.rs
index ea8fa363..ec9b774 100644
--- a/library/alloc/src/collections/btree/map/entry.rs
+++ b/library/alloc/src/collections/btree/map/entry.rs
@@ -136,10 +136,6 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
impl<'a, K: core::fmt::Debug + Ord, V: core::fmt::Debug> core::error::Error
for crate::collections::btree_map::OccupiedError<'a, K, V>
{
- #[allow(deprecated)]
- fn description(&self) -> &str {
- "key already exists"
- }
}
impl<'a, K: Ord, V, A: Allocator + Clone> Entry<'a, K, V, A> {
diff --git a/library/alloc/src/ffi/c_str.rs b/library/alloc/src/ffi/c_str.rs
index fe6c89a..b0c8c4b 100644
--- a/library/alloc/src/ffi/c_str.rs
+++ b/library/alloc/src/ffi/c_str.rs
@@ -1061,17 +1061,10 @@ pub fn utf8_error(&self) -> Utf8Error {
}
}
-impl IntoStringError {
- fn description(&self) -> &str {
- "C string contained non-utf8 bytes"
- }
-}
-
#[stable(feature = "cstring_into", since = "1.7.0")]
impl fmt::Display for IntoStringError {
- #[allow(deprecated, deprecated_in_future)]
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
- self.description().fmt(f)
+ "C string contained non-utf8 bytes".fmt(f)
}
}
@@ -1291,23 +1284,13 @@ fn ne(&self, other: &CString) -> bool {
}
#[stable(feature = "rust1", since = "1.0.0")]
-impl core::error::Error for NulError {
- #[allow(deprecated)]
- fn description(&self) -> &str {
- "nul byte found in data"
- }
-}
+impl core::error::Error for NulError {}
#[stable(feature = "cstring_from_vec_with_nul", since = "1.58.0")]
impl core::error::Error for FromVecWithNulError {}
#[stable(feature = "cstring_into", since = "1.7.0")]
impl core::error::Error for IntoStringError {
- #[allow(deprecated)]
- fn description(&self) -> &str {
- "C string contained non-utf8 bytes"
- }
-
fn source(&self) -> Option<&(dyn core::error::Error + 'static)> {
Some(&self.error)
}
diff --git a/library/alloc/src/string.rs b/library/alloc/src/string.rs
index 9eacbf0..11fd434 100644
--- a/library/alloc/src/string.rs
+++ b/library/alloc/src/string.rs
@@ -2285,20 +2285,10 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
}
#[stable(feature = "rust1", since = "1.0.0")]
-impl Error for FromUtf8Error {
- #[allow(deprecated)]
- fn description(&self) -> &str {
- "invalid utf-8"
- }
-}
+impl Error for FromUtf8Error {}
#[stable(feature = "rust1", since = "1.0.0")]
-impl Error for FromUtf16Error {
- #[allow(deprecated)]
- fn description(&self) -> &str {
- "invalid utf-16"
- }
-}
+impl Error for FromUtf16Error {}
#[cfg(not(no_global_oom_handling))]
#[stable(feature = "rust1", since = "1.0.0")]
diff --git a/library/alloc/src/sync.rs b/library/alloc/src/sync.rs
index 29caa7b..a21b688 100644
--- a/library/alloc/src/sync.rs
+++ b/library/alloc/src/sync.rs
@@ -4113,11 +4113,6 @@ fn drop(&mut self) {
#[stable(feature = "arc_error", since = "1.52.0")]
impl<T: core::error::Error + ?Sized> core::error::Error for Arc<T> {
- #[allow(deprecated, deprecated_in_future)]
- fn description(&self) -> &str {
- core::error::Error::description(&**self)
- }
-
#[allow(deprecated)]
fn cause(&self) -> Option<&dyn core::error::Error> {
core::error::Error::cause(&**self)
diff --git a/library/core/src/array/mod.rs b/library/core/src/array/mod.rs
index bb75ec7..835ee57 100644
--- a/library/core/src/array/mod.rs
+++ b/library/core/src/array/mod.rs
@@ -184,18 +184,12 @@
impl fmt::Display for TryFromSliceError {
#[inline]
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
- #[allow(deprecated)]
- self.description().fmt(f)
+ "could not convert slice to array".fmt(f)
}
}
#[stable(feature = "try_from", since = "1.34.0")]
-impl Error for TryFromSliceError {
- #[allow(deprecated)]
- fn description(&self) -> &str {
- "could not convert slice to array"
- }
-}
+impl Error for TryFromSliceError {}
#[stable(feature = "try_from_slice_error", since = "1.36.0")]
#[rustc_const_unstable(feature = "const_try", issue = "74935")]
diff --git a/library/core/src/char/convert.rs b/library/core/src/char/convert.rs
index 23061cb..cf5a91b 100644
--- a/library/core/src/char/convert.rs
+++ b/library/core/src/char/convert.rs
@@ -193,21 +193,16 @@ enum CharErrorKind {
}
#[stable(feature = "char_from_str", since = "1.20.0")]
-impl Error for ParseCharError {
- #[allow(deprecated)]
- fn description(&self) -> &str {
- match self.kind {
- CharErrorKind::EmptyString => "cannot parse char from empty string",
- CharErrorKind::TooManyChars => "too many characters in string",
- }
- }
-}
+impl Error for ParseCharError {}
#[stable(feature = "char_from_str", since = "1.20.0")]
impl fmt::Display for ParseCharError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
- #[allow(deprecated)]
- self.description().fmt(f)
+ match self.kind {
+ CharErrorKind::EmptyString => "cannot parse char from empty string",
+ CharErrorKind::TooManyChars => "too many characters in string",
+ }
+ .fmt(f)
}
}
diff --git a/library/core/src/char/decode.rs b/library/core/src/char/decode.rs
index 23319fb..d7c5f45 100644
--- a/library/core/src/char/decode.rs
+++ b/library/core/src/char/decode.rs
@@ -126,9 +126,4 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
}
#[stable(feature = "decode_utf16", since = "1.9.0")]
-impl Error for DecodeUtf16Error {
- #[allow(deprecated)]
- fn description(&self) -> &str {
- "unpaired surrogate found"
- }
-}
+impl Error for DecodeUtf16Error {}
diff --git a/library/core/src/convert/mod.rs b/library/core/src/convert/mod.rs
index 0c3034c..a0a7b79 100644
--- a/library/core/src/convert/mod.rs
+++ b/library/core/src/convert/mod.rs
@@ -958,11 +958,7 @@ fn fmt(&self, _: &mut fmt::Formatter<'_>) -> fmt::Result {
}
#[stable(feature = "str_parse_error2", since = "1.8.0")]
-impl Error for Infallible {
- fn description(&self) -> &str {
- match *self {}
- }
-}
+impl Error for Infallible {}
#[stable(feature = "convert_infallible", since = "1.34.0")]
#[rustc_const_unstable(feature = "const_cmp", issue = "143800")]
diff --git a/library/core/src/error.rs b/library/core/src/error.rs
index 88e633c..92b3c83 100644
--- a/library/core/src/error.rs
+++ b/library/core/src/error.rs
@@ -1042,11 +1042,6 @@ impl<'a> crate::iter::FusedIterator for Source<'a> {}
#[stable(feature = "error_by_ref", since = "1.51.0")]
impl<'a, T: Error + ?Sized> Error for &'a T {
- #[allow(deprecated, deprecated_in_future)]
- fn description(&self) -> &str {
- Error::description(&**self)
- }
-
#[allow(deprecated)]
fn cause(&self) -> Option<&dyn Error> {
Error::cause(&**self)
@@ -1062,36 +1057,16 @@ fn provide<'b>(&'b self, request: &mut Request<'b>) {
}
#[stable(feature = "fmt_error", since = "1.11.0")]
-impl Error for crate::fmt::Error {
- #[allow(deprecated)]
- fn description(&self) -> &str {
- "an error occurred when formatting an argument"
- }
-}
+impl Error for crate::fmt::Error {}
#[stable(feature = "try_borrow", since = "1.13.0")]
-impl Error for crate::cell::BorrowError {
- #[allow(deprecated)]
- fn description(&self) -> &str {
- "already mutably borrowed"
- }
-}
+impl Error for crate::cell::BorrowError {}
#[stable(feature = "try_borrow", since = "1.13.0")]
-impl Error for crate::cell::BorrowMutError {
- #[allow(deprecated)]
- fn description(&self) -> &str {
- "already borrowed"
- }
-}
+impl Error for crate::cell::BorrowMutError {}
#[stable(feature = "try_from", since = "1.34.0")]
-impl Error for crate::char::CharTryFromError {
- #[allow(deprecated)]
- fn description(&self) -> &str {
- "converted integer out of range for `char`"
- }
-}
+impl Error for crate::char::CharTryFromError {}
#[stable(feature = "duration_checked_float", since = "1.66.0")]
impl Error for crate::time::TryFromFloatSecsError {}
diff --git a/library/core/src/fmt/mod.rs b/library/core/src/fmt/mod.rs
index 8ac29e5..b6de892 100644
--- a/library/core/src/fmt/mod.rs
+++ b/library/core/src/fmt/mod.rs
@@ -359,7 +359,7 @@ pub const fn new() -> Self {
/// always be printed.
/// - `-`: Currently not used
#[unstable(feature = "formatting_options", issue = "118117")]
- pub fn sign(&mut self, sign: Option<Sign>) -> &mut Self {
+ pub const fn sign(&mut self, sign: Option<Sign>) -> &mut Self {
let sign = match sign {
None => 0,
Some(Sign::Plus) => flags::SIGN_PLUS_FLAG,
@@ -372,7 +372,7 @@ pub fn sign(&mut self, sign: Option<Sign>) -> &mut Self {
///
/// This is used to indicate for integer formats that the padding to width should both be done with a 0 character as well as be sign-aware
#[unstable(feature = "formatting_options", issue = "118117")]
- pub fn sign_aware_zero_pad(&mut self, sign_aware_zero_pad: bool) -> &mut Self {
+ pub const fn sign_aware_zero_pad(&mut self, sign_aware_zero_pad: bool) -> &mut Self {
if sign_aware_zero_pad {
self.flags |= flags::SIGN_AWARE_ZERO_PAD_FLAG;
} else {
@@ -389,7 +389,7 @@ pub fn sign_aware_zero_pad(&mut self, sign_aware_zero_pad: bool) -> &mut Self {
/// - [`Octal`] - precedes the argument with a `0b`
/// - [`Binary`] - precedes the argument with a `0o`
#[unstable(feature = "formatting_options", issue = "118117")]
- pub fn alternate(&mut self, alternate: bool) -> &mut Self {
+ pub const fn alternate(&mut self, alternate: bool) -> &mut Self {
if alternate {
self.flags |= flags::ALTERNATE_FLAG;
} else {
@@ -404,7 +404,7 @@ pub fn alternate(&mut self, alternate: bool) -> &mut Self {
/// being formatted is smaller than width some extra characters will be
/// printed around it.
#[unstable(feature = "formatting_options", issue = "118117")]
- pub fn fill(&mut self, fill: char) -> &mut Self {
+ pub const fn fill(&mut self, fill: char) -> &mut Self {
self.flags = self.flags & (u32::MAX << 21) | fill as u32;
self
}
@@ -413,7 +413,7 @@ pub fn fill(&mut self, fill: char) -> &mut Self {
/// The alignment specifies how the value being formatted should be
/// positioned if it is smaller than the width of the formatter.
#[unstable(feature = "formatting_options", issue = "118117")]
- pub fn align(&mut self, align: Option<Alignment>) -> &mut Self {
+ pub const fn align(&mut self, align: Option<Alignment>) -> &mut Self {
let align: u32 = match align {
Some(Alignment::Left) => flags::ALIGN_LEFT,
Some(Alignment::Right) => flags::ALIGN_RIGHT,
@@ -430,7 +430,7 @@ pub fn align(&mut self, align: Option<Alignment>) -> &mut Self {
/// the padding specified by [`FormattingOptions::fill`]/[`FormattingOptions::align`]
/// will be used to take up the required space.
#[unstable(feature = "formatting_options", issue = "118117")]
- pub fn width(&mut self, width: Option<u16>) -> &mut Self {
+ pub const fn width(&mut self, width: Option<u16>) -> &mut Self {
if let Some(width) = width {
self.flags |= flags::WIDTH_FLAG;
self.width = width;
@@ -450,7 +450,7 @@ pub fn width(&mut self, width: Option<u16>) -> &mut Self {
/// - For floating-point types, this indicates how many digits after the
/// decimal point should be printed.
#[unstable(feature = "formatting_options", issue = "118117")]
- pub fn precision(&mut self, precision: Option<u16>) -> &mut Self {
+ pub const fn precision(&mut self, precision: Option<u16>) -> &mut Self {
if let Some(precision) = precision {
self.flags |= flags::PRECISION_FLAG;
self.precision = precision;
@@ -463,7 +463,7 @@ pub fn precision(&mut self, precision: Option<u16>) -> &mut Self {
/// Specifies whether the [`Debug`] trait should use lower-/upper-case
/// hexadecimal or normal integers
#[unstable(feature = "formatting_options", issue = "118117")]
- pub fn debug_as_hex(&mut self, debug_as_hex: Option<DebugAsHex>) -> &mut Self {
+ pub const fn debug_as_hex(&mut self, debug_as_hex: Option<DebugAsHex>) -> &mut Self {
let debug_as_hex = match debug_as_hex {
None => 0,
Some(DebugAsHex::Lower) => flags::DEBUG_LOWER_HEX_FLAG,
@@ -537,7 +537,7 @@ pub const fn get_debug_as_hex(&self) -> Option<DebugAsHex> {
///
/// You may alternatively use [`Formatter::new()`].
#[unstable(feature = "formatting_options", issue = "118117")]
- pub fn create_formatter<'a>(self, write: &'a mut (dyn Write + 'a)) -> Formatter<'a> {
+ pub const fn create_formatter<'a>(self, write: &'a mut (dyn Write + 'a)) -> Formatter<'a> {
Formatter { options: self, buf: write }
}
}
@@ -578,13 +578,13 @@ impl<'a> Formatter<'a> {
///
/// You may alternatively use [`FormattingOptions::create_formatter()`].
#[unstable(feature = "formatting_options", issue = "118117")]
- pub fn new(write: &'a mut (dyn Write + 'a), options: FormattingOptions) -> Self {
+ pub const fn new(write: &'a mut (dyn Write + 'a), options: FormattingOptions) -> Self {
Formatter { options, buf: write }
}
/// Creates a new formatter based on this one with given [`FormattingOptions`].
#[unstable(feature = "formatting_options", issue = "118117")]
- pub fn with_options<'b>(&'b mut self, options: FormattingOptions) -> Formatter<'b> {
+ pub const fn with_options<'b>(&'b mut self, options: FormattingOptions) -> Formatter<'b> {
Formatter { options, buf: self.buf }
}
}
diff --git a/library/core/src/net/parser.rs b/library/core/src/net/parser.rs
index 73230f6..3aab24a 100644
--- a/library/core/src/net/parser.rs
+++ b/library/core/src/net/parser.rs
@@ -497,16 +497,7 @@ enum AddrKind {
#[stable(feature = "addr_parse_error_error", since = "1.4.0")]
impl fmt::Display for AddrParseError {
- #[allow(deprecated, deprecated_in_future)]
- fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
- fmt.write_str(self.description())
- }
-}
-
-#[stable(feature = "addr_parse_error_error", since = "1.4.0")]
-impl Error for AddrParseError {
- #[allow(deprecated)]
- fn description(&self) -> &str {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self.0 {
AddrKind::Ip => "invalid IP address syntax",
AddrKind::Ipv4 => "invalid IPv4 address syntax",
@@ -515,5 +506,9 @@ fn description(&self) -> &str {
AddrKind::SocketV4 => "invalid IPv4 socket address syntax",
AddrKind::SocketV6 => "invalid IPv6 socket address syntax",
}
+ .fmt(f)
}
}
+
+#[stable(feature = "addr_parse_error_error", since = "1.4.0")]
+impl Error for AddrParseError {}
diff --git a/library/core/src/num/dec2flt/mod.rs b/library/core/src/num/dec2flt/mod.rs
index 3118a6e..dd4eccd 100644
--- a/library/core/src/num/dec2flt/mod.rs
+++ b/library/core/src/num/dec2flt/mod.rs
@@ -219,21 +219,16 @@ enum FloatErrorKind {
}
#[stable(feature = "rust1", since = "1.0.0")]
-impl Error for ParseFloatError {
- #[allow(deprecated)]
- fn description(&self) -> &str {
- match self.kind {
- FloatErrorKind::Empty => "cannot parse float from empty string",
- FloatErrorKind::Invalid => "invalid float literal",
- }
- }
-}
+impl Error for ParseFloatError {}
#[stable(feature = "rust1", since = "1.0.0")]
impl fmt::Display for ParseFloatError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
- #[allow(deprecated)]
- self.description().fmt(f)
+ match self.kind {
+ FloatErrorKind::Empty => "cannot parse float from empty string",
+ FloatErrorKind::Invalid => "invalid float literal",
+ }
+ .fmt(f)
}
}
diff --git a/library/core/src/num/error.rs b/library/core/src/num/error.rs
index cfedd46..faa5232 100644
--- a/library/core/src/num/error.rs
+++ b/library/core/src/num/error.rs
@@ -11,19 +11,13 @@
#[stable(feature = "try_from", since = "1.34.0")]
impl fmt::Display for TryFromIntError {
- fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
- #[allow(deprecated)]
- self.description().fmt(fmt)
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+ "out of range integral type conversion attempted".fmt(f)
}
}
#[stable(feature = "try_from", since = "1.34.0")]
-impl Error for TryFromIntError {
- #[allow(deprecated)]
- fn description(&self) -> &str {
- "out of range integral type conversion attempted"
- }
-}
+impl Error for TryFromIntError {}
#[stable(feature = "try_from", since = "1.34.0")]
#[rustc_const_unstable(feature = "const_try", issue = "74935")]
@@ -128,15 +122,6 @@ pub const fn kind(&self) -> &IntErrorKind {
#[stable(feature = "rust1", since = "1.0.0")]
impl fmt::Display for ParseIntError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
- #[allow(deprecated)]
- self.description().fmt(f)
- }
-}
-
-#[stable(feature = "rust1", since = "1.0.0")]
-impl Error for ParseIntError {
- #[allow(deprecated)]
- fn description(&self) -> &str {
match self.kind {
IntErrorKind::Empty => "cannot parse integer from empty string",
IntErrorKind::InvalidDigit => "invalid digit found in string",
@@ -144,5 +129,9 @@ fn description(&self) -> &str {
IntErrorKind::NegOverflow => "number too small to fit in target type",
IntErrorKind::Zero => "number would be zero for non-zero type",
}
+ .fmt(f)
}
}
+
+#[stable(feature = "rust1", since = "1.0.0")]
+impl Error for ParseIntError {}
diff --git a/library/core/src/str/error.rs b/library/core/src/str/error.rs
index 4c8231a..1677c84 100644
--- a/library/core/src/str/error.rs
+++ b/library/core/src/str/error.rs
@@ -124,12 +124,7 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
}
#[stable(feature = "rust1", since = "1.0.0")]
-impl Error for Utf8Error {
- #[allow(deprecated)]
- fn description(&self) -> &str {
- "invalid utf-8: corrupt contents"
- }
-}
+impl Error for Utf8Error {}
/// An error returned when parsing a `bool` using [`from_str`] fails
///
@@ -147,9 +142,4 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
}
#[stable(feature = "rust1", since = "1.0.0")]
-impl Error for ParseBoolError {
- #[allow(deprecated)]
- fn description(&self) -> &str {
- "failed to parse bool"
- }
-}
+impl Error for ParseBoolError {}
diff --git a/library/core/src/time.rs b/library/core/src/time.rs
index 0cc570f..f37e47f 100644
--- a/library/core/src/time.rs
+++ b/library/core/src/time.rs
@@ -927,7 +927,7 @@ pub const fn as_millis_f32(&self) -> f32 {
pub fn from_secs_f64(secs: f64) -> Duration {
match Duration::try_from_secs_f64(secs) {
Ok(v) => v,
- Err(e) => panic!("{}", e.description()),
+ Err(e) => panic!("{e}"),
}
}
@@ -964,7 +964,7 @@ pub fn from_secs_f64(secs: f64) -> Duration {
pub fn from_secs_f32(secs: f32) -> Duration {
match Duration::try_from_secs_f32(secs) {
Ok(v) => v,
- Err(e) => panic!("{}", e.description()),
+ Err(e) => panic!("{e}"),
}
}
@@ -1445,8 +1445,9 @@ pub struct TryFromFloatSecsError {
kind: TryFromFloatSecsErrorKind,
}
-impl TryFromFloatSecsError {
- const fn description(&self) -> &'static str {
+#[stable(feature = "duration_checked_float", since = "1.66.0")]
+impl fmt::Display for TryFromFloatSecsError {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self.kind {
TryFromFloatSecsErrorKind::Negative => {
"cannot convert float seconds to Duration: value is negative"
@@ -1455,13 +1456,7 @@ const fn description(&self) -> &'static str {
"cannot convert float seconds to Duration: value is either too big or NaN"
}
}
- }
-}
-
-#[stable(feature = "duration_checked_float", since = "1.66.0")]
-impl fmt::Display for TryFromFloatSecsError {
- fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
- self.description().fmt(f)
+ .fmt(f)
}
}
diff --git a/library/std/src/collections/hash/map.rs b/library/std/src/collections/hash/map.rs
index 15a7a77..fc0fef6 100644
--- a/library/std/src/collections/hash/map.rs
+++ b/library/std/src/collections/hash/map.rs
@@ -1875,12 +1875,7 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
}
#[unstable(feature = "map_try_insert", issue = "82766")]
-impl<'a, K: fmt::Debug, V: fmt::Debug> Error for OccupiedError<'a, K, V> {
- #[allow(deprecated)]
- fn description(&self) -> &str {
- "key already exists"
- }
-}
+impl<'a, K: Debug, V: Debug> Error for OccupiedError<'a, K, V> {}
#[stable(feature = "rust1", since = "1.0.0")]
impl<'a, K, V, S> IntoIterator for &'a HashMap<K, V, S> {
diff --git a/library/std/src/env.rs b/library/std/src/env.rs
index 9f17ff7..e457cd6 100644
--- a/library/std/src/env.rs
+++ b/library/std/src/env.rs
@@ -296,15 +296,7 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
}
#[stable(feature = "env", since = "1.0.0")]
-impl Error for VarError {
- #[allow(deprecated)]
- fn description(&self) -> &str {
- match *self {
- VarError::NotPresent => "environment variable not found",
- VarError::NotUnicode(..) => "environment variable was not valid unicode",
- }
- }
-}
+impl Error for VarError {}
/// Sets the environment variable `key` to the value `value` for the currently running
/// process.
diff --git a/library/std/src/io/buffered/bufwriter.rs b/library/std/src/io/buffered/bufwriter.rs
index 574eb83d..d569fed 100644
--- a/library/std/src/io/buffered/bufwriter.rs
+++ b/library/std/src/io/buffered/bufwriter.rs
@@ -492,23 +492,15 @@ impl WriterPanicked {
pub fn into_inner(self) -> Vec<u8> {
self.buf
}
-
- const DESCRIPTION: &'static str =
- "BufWriter inner writer panicked, what data remains unwritten is not known";
}
#[stable(feature = "bufwriter_into_parts", since = "1.56.0")]
-impl error::Error for WriterPanicked {
- #[allow(deprecated, deprecated_in_future)]
- fn description(&self) -> &str {
- Self::DESCRIPTION
- }
-}
+impl error::Error for WriterPanicked {}
#[stable(feature = "bufwriter_into_parts", since = "1.56.0")]
impl fmt::Display for WriterPanicked {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
- write!(f, "{}", Self::DESCRIPTION)
+ "BufWriter inner writer panicked, what data remains unwritten is not known".fmt(f)
}
}
diff --git a/library/std/src/io/buffered/mod.rs b/library/std/src/io/buffered/mod.rs
index 475d877..e36f2d92 100644
--- a/library/std/src/io/buffered/mod.rs
+++ b/library/std/src/io/buffered/mod.rs
@@ -179,12 +179,7 @@ fn from(iie: IntoInnerError<W>) -> Error {
}
#[stable(feature = "rust1", since = "1.0.0")]
-impl<W: Send + fmt::Debug> error::Error for IntoInnerError<W> {
- #[allow(deprecated, deprecated_in_future)]
- fn description(&self) -> &str {
- error::Error::description(self.error())
- }
-}
+impl<W: Send + fmt::Debug> error::Error for IntoInnerError<W> {}
#[stable(feature = "rust1", since = "1.0.0")]
impl<W> fmt::Display for IntoInnerError<W> {
diff --git a/library/std/src/io/error.rs b/library/std/src/io/error.rs
index dcfa189..57a980d 100644
--- a/library/std/src/io/error.rs
+++ b/library/std/src/io/error.rs
@@ -1049,15 +1049,6 @@ fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
#[stable(feature = "rust1", since = "1.0.0")]
impl error::Error for Error {
- #[allow(deprecated, deprecated_in_future)]
- fn description(&self) -> &str {
- match self.repr.data() {
- ErrorData::Os(..) | ErrorData::Simple(..) => self.kind().as_str(),
- ErrorData::SimpleMessage(msg) => msg.message,
- ErrorData::Custom(c) => c.error.description(),
- }
- }
-
#[allow(deprecated)]
fn cause(&self) -> Option<&dyn error::Error> {
match self.repr.data() {
diff --git a/library/std/src/os/windows/io/socket.rs b/library/std/src/os/windows/io/socket.rs
index 1c228914..28e9729 100644
--- a/library/std/src/os/windows/io/socket.rs
+++ b/library/std/src/os/windows/io/socket.rs
@@ -54,7 +54,7 @@ impl BorrowedSocket<'_> {
///
/// # Safety
///
- /// The resource pointed to by `raw` must remain open for the duration of
+ /// The resource pointed to by `socket` must remain open for the duration of
/// the returned `BorrowedSocket`, and it must not have the value
/// `INVALID_SOCKET`.
#[inline]
diff --git a/library/std/src/path.rs b/library/std/src/path.rs
index 3899fbf..470d300 100644
--- a/library/std/src/path.rs
+++ b/library/std/src/path.rs
@@ -3677,19 +3677,13 @@ fn partial_cmp(&self, other: &$lhs) -> Option<cmp::Ordering> {
#[stable(since = "1.7.0", feature = "strip_prefix")]
impl fmt::Display for StripPrefixError {
- #[allow(deprecated, deprecated_in_future)]
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
- self.description().fmt(f)
+ "prefix not found".fmt(f)
}
}
#[stable(since = "1.7.0", feature = "strip_prefix")]
-impl Error for StripPrefixError {
- #[allow(deprecated)]
- fn description(&self) -> &str {
- "prefix not found"
- }
-}
+impl Error for StripPrefixError {}
#[unstable(feature = "normalize_lexically", issue = "134694")]
impl fmt::Display for NormalizeError {
diff --git a/library/std/src/sync/mpsc.rs b/library/std/src/sync/mpsc.rs
index 03d7fdd..f91c26a 100644
--- a/library/std/src/sync/mpsc.rs
+++ b/library/std/src/sync/mpsc.rs
@@ -1108,12 +1108,7 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
}
#[stable(feature = "rust1", since = "1.0.0")]
-impl<T> error::Error for SendError<T> {
- #[allow(deprecated)]
- fn description(&self) -> &str {
- "sending on a closed channel"
- }
-}
+impl<T> error::Error for SendError<T> {}
#[stable(feature = "rust1", since = "1.0.0")]
impl<T> fmt::Debug for TrySendError<T> {
@@ -1136,15 +1131,7 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
}
#[stable(feature = "rust1", since = "1.0.0")]
-impl<T> error::Error for TrySendError<T> {
- #[allow(deprecated)]
- fn description(&self) -> &str {
- match *self {
- TrySendError::Full(..) => "sending on a full channel",
- TrySendError::Disconnected(..) => "sending on a closed channel",
- }
- }
-}
+impl<T> error::Error for TrySendError<T> {}
#[stable(feature = "mpsc_error_conversions", since = "1.24.0")]
impl<T> From<SendError<T>> for TrySendError<T> {
@@ -1168,12 +1155,7 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
}
#[stable(feature = "rust1", since = "1.0.0")]
-impl error::Error for RecvError {
- #[allow(deprecated)]
- fn description(&self) -> &str {
- "receiving on a closed channel"
- }
-}
+impl error::Error for RecvError {}
#[stable(feature = "rust1", since = "1.0.0")]
impl fmt::Display for TryRecvError {
@@ -1186,15 +1168,7 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
}
#[stable(feature = "rust1", since = "1.0.0")]
-impl error::Error for TryRecvError {
- #[allow(deprecated)]
- fn description(&self) -> &str {
- match *self {
- TryRecvError::Empty => "receiving on an empty channel",
- TryRecvError::Disconnected => "receiving on a closed channel",
- }
- }
-}
+impl error::Error for TryRecvError {}
#[stable(feature = "mpsc_error_conversions", since = "1.24.0")]
impl From<RecvError> for TryRecvError {
@@ -1221,15 +1195,7 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
}
#[stable(feature = "mpsc_recv_timeout_error", since = "1.15.0")]
-impl error::Error for RecvTimeoutError {
- #[allow(deprecated)]
- fn description(&self) -> &str {
- match *self {
- RecvTimeoutError::Timeout => "timed out waiting on channel",
- RecvTimeoutError::Disconnected => "channel is empty and sending half is closed",
- }
- }
-}
+impl error::Error for RecvTimeoutError {}
#[stable(feature = "mpsc_error_conversions", since = "1.24.0")]
impl From<RecvError> for RecvTimeoutError {
diff --git a/library/std/src/sync/poison.rs b/library/std/src/sync/poison.rs
index 31889dc..49a71b9a 100644
--- a/library/std/src/sync/poison.rs
+++ b/library/std/src/sync/poison.rs
@@ -263,12 +263,7 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
}
#[stable(feature = "rust1", since = "1.0.0")]
-impl<T> Error for PoisonError<T> {
- #[allow(deprecated)]
- fn description(&self) -> &str {
- "poisoned lock: another task failed inside"
- }
-}
+impl<T> Error for PoisonError<T> {}
impl<T> PoisonError<T> {
/// Creates a `PoisonError`.
@@ -376,17 +371,6 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
#[stable(feature = "rust1", since = "1.0.0")]
impl<T> Error for TryLockError<T> {
- #[allow(deprecated, deprecated_in_future)]
- fn description(&self) -> &str {
- match *self {
- #[cfg(panic = "unwind")]
- TryLockError::Poisoned(ref p) => p.description(),
- #[cfg(not(panic = "unwind"))]
- TryLockError::Poisoned(ref p) => match p._never {},
- TryLockError::WouldBlock => "try_lock failed because the operation would block",
- }
- }
-
#[allow(deprecated)]
fn cause(&self) -> Option<&dyn Error> {
match *self {
diff --git a/library/std/src/sys/net/connection/sgx.rs b/library/std/src/sys/net/connection/sgx.rs
index 242df10..2389fd1 100644
--- a/library/std/src/sys/net/connection/sgx.rs
+++ b/library/std/src/sys/net/connection/sgx.rs
@@ -452,12 +452,7 @@ pub struct NonIpSockAddr {
host: String,
}
-impl error::Error for NonIpSockAddr {
- #[allow(deprecated)]
- fn description(&self) -> &str {
- "Failed to convert address to SocketAddr"
- }
-}
+impl error::Error for NonIpSockAddr {}
impl fmt::Display for NonIpSockAddr {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
diff --git a/library/std/src/sys/pal/hermit/os.rs b/library/std/src/sys/pal/hermit/os.rs
index a998c31..0fe713a 100644
--- a/library/std/src/sys/pal/hermit/os.rs
+++ b/library/std/src/sys/pal/hermit/os.rs
@@ -1,5 +1,4 @@
use super::hermit_abi;
-use crate::error::Error as StdError;
use crate::ffi::{OsStr, OsString};
use crate::marker::PhantomData;
use crate::path::{self, PathBuf};
@@ -52,12 +51,7 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
}
}
-impl StdError for JoinPathsError {
- #[allow(deprecated)]
- fn description(&self) -> &str {
- "not supported on hermit yet"
- }
-}
+impl crate::error::Error for JoinPathsError {}
pub fn current_exe() -> io::Result<PathBuf> {
unsupported()
diff --git a/library/std/src/sys/pal/sgx/mod.rs b/library/std/src/sys/pal/sgx/mod.rs
index 6e43a79..4a297b6 100644
--- a/library/std/src/sys/pal/sgx/mod.rs
+++ b/library/std/src/sys/pal/sgx/mod.rs
@@ -59,8 +59,7 @@ pub fn sgx_ineffective<T>(v: T) -> crate::io::Result<T> {
#[inline]
pub fn is_interrupted(code: i32) -> bool {
- use fortanix_sgx_abi::Error;
- code == Error::Interrupted as _
+ code == fortanix_sgx_abi::Error::Interrupted as _
}
pub fn decode_error_kind(code: i32) -> ErrorKind {
diff --git a/library/std/src/sys/pal/sgx/os.rs b/library/std/src/sys/pal/sgx/os.rs
index 70f8386..28d7996 100644
--- a/library/std/src/sys/pal/sgx/os.rs
+++ b/library/std/src/sys/pal/sgx/os.rs
@@ -1,11 +1,10 @@
use fortanix_sgx_abi::{Error, RESULT_SUCCESS};
-use crate::error::Error as StdError;
use crate::ffi::{OsStr, OsString};
use crate::marker::PhantomData;
use crate::path::{self, PathBuf};
use crate::sys::{decode_error_kind, sgx_ineffective, unsupported};
-use crate::{fmt, io, str};
+use crate::{fmt, io};
pub fn errno() -> i32 {
RESULT_SUCCESS
@@ -59,12 +58,7 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
}
}
-impl StdError for JoinPathsError {
- #[allow(deprecated)]
- fn description(&self) -> &str {
- "not supported in SGX yet"
- }
-}
+impl crate::error::Error for JoinPathsError {}
pub fn current_exe() -> io::Result<PathBuf> {
unsupported()
diff --git a/library/std/src/sys/pal/solid/os.rs b/library/std/src/sys/pal/solid/os.rs
index 8f5976b..cb6e2cb 100644
--- a/library/std/src/sys/pal/solid/os.rs
+++ b/library/std/src/sys/pal/solid/os.rs
@@ -1,5 +1,4 @@
use super::{error, itron, unsupported};
-use crate::error::Error as StdError;
use crate::ffi::{OsStr, OsString};
use crate::path::{self, PathBuf};
use crate::{fmt, io};
@@ -58,12 +57,7 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
}
}
-impl StdError for JoinPathsError {
- #[allow(deprecated)]
- fn description(&self) -> &str {
- "not supported on this platform yet"
- }
-}
+impl crate::error::Error for JoinPathsError {}
pub fn current_exe() -> io::Result<PathBuf> {
unsupported()
diff --git a/library/std/src/sys/pal/teeos/os.rs b/library/std/src/sys/pal/teeos/os.rs
index 03f3c72..512b3e2 100644
--- a/library/std/src/sys/pal/teeos/os.rs
+++ b/library/std/src/sys/pal/teeos/os.rs
@@ -3,7 +3,6 @@
use core::marker::PhantomData;
use super::unsupported;
-use crate::error::Error as StdError;
use crate::ffi::{OsStr, OsString};
use crate::path::PathBuf;
use crate::{fmt, io, path};
@@ -62,12 +61,7 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
}
}
-impl StdError for JoinPathsError {
- #[allow(deprecated)]
- fn description(&self) -> &str {
- "not supported on this platform yet"
- }
-}
+impl crate::error::Error for JoinPathsError {}
pub fn current_exe() -> io::Result<PathBuf> {
unsupported()
diff --git a/library/std/src/sys/pal/uefi/os.rs b/library/std/src/sys/pal/uefi/os.rs
index bfd4dc8..aae6cb9 100644
--- a/library/std/src/sys/pal/uefi/os.rs
+++ b/library/std/src/sys/pal/uefi/os.rs
@@ -2,7 +2,6 @@
use r_efi::efi::protocols::{device_path, loaded_image_device_path};
use super::{RawOsError, helpers, unsupported_err};
-use crate::error::Error as StdError;
use crate::ffi::{OsStr, OsString};
use crate::marker::PhantomData;
use crate::os::uefi;
@@ -122,7 +121,7 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
}
}
-impl StdError for JoinPathsError {}
+impl crate::error::Error for JoinPathsError {}
pub fn current_exe() -> io::Result<PathBuf> {
let protocol = helpers::image_handle_protocol::<device_path::Protocol>(
diff --git a/library/std/src/sys/pal/unix/os.rs b/library/std/src/sys/pal/unix/os.rs
index 1110b77..81275af 100644
--- a/library/std/src/sys/pal/unix/os.rs
+++ b/library/std/src/sys/pal/unix/os.rs
@@ -7,7 +7,6 @@
use libc::{c_char, c_int, c_void};
-use crate::error::Error as StdError;
use crate::ffi::{CStr, OsStr, OsString};
use crate::os::unix::prelude::*;
use crate::path::{self, PathBuf};
@@ -248,12 +247,7 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
}
}
-impl StdError for JoinPathsError {
- #[allow(deprecated)]
- fn description(&self) -> &str {
- "failed to join paths"
- }
-}
+impl crate::error::Error for JoinPathsError {}
#[cfg(target_os = "aix")]
pub fn current_exe() -> io::Result<PathBuf> {
diff --git a/library/std/src/sys/pal/unsupported/os.rs b/library/std/src/sys/pal/unsupported/os.rs
index a8ef97e..13d2a204 100644
--- a/library/std/src/sys/pal/unsupported/os.rs
+++ b/library/std/src/sys/pal/unsupported/os.rs
@@ -1,5 +1,4 @@
use super::unsupported;
-use crate::error::Error as StdError;
use crate::ffi::{OsStr, OsString};
use crate::marker::PhantomData;
use crate::path::{self, PathBuf};
@@ -51,12 +50,7 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
}
}
-impl StdError for JoinPathsError {
- #[allow(deprecated)]
- fn description(&self) -> &str {
- "not supported on this platform yet"
- }
-}
+impl crate::error::Error for JoinPathsError {}
pub fn current_exe() -> io::Result<PathBuf> {
unsupported()
diff --git a/library/std/src/sys/pal/wasi/os.rs b/library/std/src/sys/pal/wasi/os.rs
index 672cf70..151ba25 100644
--- a/library/std/src/sys/pal/wasi/os.rs
+++ b/library/std/src/sys/pal/wasi/os.rs
@@ -1,6 +1,5 @@
#![forbid(unsafe_op_in_unsafe_fn)]
-use crate::error::Error as StdError;
use crate::ffi::{CStr, OsStr, OsString};
use crate::marker::PhantomData;
use crate::os::wasi::prelude::*;
@@ -105,12 +104,7 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
}
}
-impl StdError for JoinPathsError {
- #[allow(deprecated)]
- fn description(&self) -> &str {
- "not supported on wasm yet"
- }
-}
+impl crate::error::Error for JoinPathsError {}
pub fn current_exe() -> io::Result<PathBuf> {
unsupported()
diff --git a/library/std/src/sys/pal/windows/os.rs b/library/std/src/sys/pal/windows/os.rs
index f331282..1b3c80c 100644
--- a/library/std/src/sys/pal/windows/os.rs
+++ b/library/std/src/sys/pal/windows/os.rs
@@ -8,7 +8,6 @@
use super::api;
#[cfg(not(target_vendor = "uwp"))]
use super::api::WinError;
-use crate::error::Error as StdError;
use crate::ffi::{OsStr, OsString};
use crate::os::windows::ffi::EncodeWide;
use crate::os::windows::prelude::*;
@@ -162,12 +161,7 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
}
}
-impl StdError for JoinPathsError {
- #[allow(deprecated)]
- fn description(&self) -> &str {
- "failed to join paths"
- }
-}
+impl crate::error::Error for JoinPathsError {}
pub fn current_exe() -> io::Result<PathBuf> {
super::fill_utf16_buf(
diff --git a/library/std/src/sys/pal/xous/os.rs b/library/std/src/sys/pal/xous/os.rs
index d612a27..d9b8418 100644
--- a/library/std/src/sys/pal/xous/os.rs
+++ b/library/std/src/sys/pal/xous/os.rs
@@ -1,5 +1,4 @@
use super::unsupported;
-use crate::error::Error as StdError;
use crate::ffi::{OsStr, OsString};
use crate::marker::PhantomData;
use crate::os::xous::ffi::Error as XousError;
@@ -110,12 +109,7 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
}
}
-impl StdError for JoinPathsError {
- #[allow(deprecated)]
- fn description(&self) -> &str {
- "not supported on this platform yet"
- }
-}
+impl crate::error::Error for JoinPathsError {}
pub fn current_exe() -> io::Result<PathBuf> {
unsupported()
diff --git a/library/std/src/sys/pal/zkvm/os.rs b/library/std/src/sys/pal/zkvm/os.rs
index a8ef97e..13d2a204 100644
--- a/library/std/src/sys/pal/zkvm/os.rs
+++ b/library/std/src/sys/pal/zkvm/os.rs
@@ -1,5 +1,4 @@
use super::unsupported;
-use crate::error::Error as StdError;
use crate::ffi::{OsStr, OsString};
use crate::marker::PhantomData;
use crate::path::{self, PathBuf};
@@ -51,12 +50,7 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
}
}
-impl StdError for JoinPathsError {
- #[allow(deprecated)]
- fn description(&self) -> &str {
- "not supported on this platform yet"
- }
-}
+impl crate::error::Error for JoinPathsError {}
pub fn current_exe() -> io::Result<PathBuf> {
unsupported()
diff --git a/library/std/src/time.rs b/library/std/src/time.rs
index 07bb41f..84fbb4c 100644
--- a/library/std/src/time.rs
+++ b/library/std/src/time.rs
@@ -717,12 +717,7 @@ pub const fn duration(&self) -> Duration {
}
#[stable(feature = "time2", since = "1.8.0")]
-impl Error for SystemTimeError {
- #[allow(deprecated)]
- fn description(&self) -> &str {
- "other time was not earlier than self"
- }
-}
+impl Error for SystemTimeError {}
#[stable(feature = "time2", since = "1.8.0")]
impl fmt::Display for SystemTimeError {
diff --git a/src/bootstrap/src/core/build_steps/compile.rs b/src/bootstrap/src/core/build_steps/compile.rs
index f7a2dc1..a497613 100644
--- a/src/bootstrap/src/core/build_steps/compile.rs
+++ b/src/bootstrap/src/core/build_steps/compile.rs
@@ -2031,6 +2031,7 @@ fn run(self, builder: &Builder<'_>) -> Compiler {
let host_llvm_bin_dir = command(&host_llvm_config)
.arg("--bindir")
+ .cached()
.run_capture_stdout(builder)
.stdout()
.trim()
diff --git a/src/bootstrap/src/core/build_steps/dist.rs b/src/bootstrap/src/core/build_steps/dist.rs
index 3c32225..778c3be 100644
--- a/src/bootstrap/src/core/build_steps/dist.rs
+++ b/src/bootstrap/src/core/build_steps/dist.rs
@@ -764,10 +764,22 @@ pub struct Std {
impl Std {
pub fn new(builder: &Builder<'_>, target: TargetSelection) -> Self {
- Std {
- build_compiler: builder.compiler(builder.top_stage, builder.config.host_target),
- target,
- }
+ // This is an important optimization mainly for CI.
+ // Normally, to build stage N libstd, we need stage N rustc.
+ // However, if we know that we will uplift libstd from stage 1 anyway, building the stage N
+ // rustc can be wasteful.
+ // In particular, if we do a cross-compiling dist stage 2 build from T1 to T2, we need:
+ // - stage 2 libstd for T2 (uplifted from stage 1, where it was built by T1 rustc)
+ // - stage 2 rustc for T2
+ // However, without this optimization, we would also build stage 2 rustc for **T1**, which
+ // is completely wasteful.
+ let build_compiler =
+ if compile::Std::should_be_uplifted_from_stage_1(builder, builder.top_stage, target) {
+ builder.compiler(1, builder.host_target)
+ } else {
+ builder.compiler(builder.top_stage, builder.host_target)
+ };
+ Std { build_compiler, target }
}
}
@@ -2269,6 +2281,7 @@ fn maybe_install_llvm(
{
trace!("LLVM already built, installing LLVM files");
let mut cmd = command(host_llvm_config);
+ cmd.cached();
cmd.arg("--libfiles");
builder.verbose(|| println!("running {cmd:?}"));
let files = cmd.run_capture_stdout(builder).stdout();
diff --git a/src/bootstrap/src/core/build_steps/llvm.rs b/src/bootstrap/src/core/build_steps/llvm.rs
index 70259f0..d47c149 100644
--- a/src/bootstrap/src/core/build_steps/llvm.rs
+++ b/src/bootstrap/src/core/build_steps/llvm.rs
@@ -486,8 +486,11 @@ fn run(self, builder: &Builder<'_>) -> LlvmResult {
let LlvmResult { host_llvm_config, .. } =
builder.ensure(Llvm { target: builder.config.host_target });
if !builder.config.dry_run() {
- let llvm_bindir =
- command(&host_llvm_config).arg("--bindir").run_capture_stdout(builder).stdout();
+ let llvm_bindir = command(&host_llvm_config)
+ .arg("--bindir")
+ .cached()
+ .run_capture_stdout(builder)
+ .stdout();
let host_bin = Path::new(llvm_bindir.trim());
cfg.define(
"LLVM_TABLEGEN",
@@ -593,7 +596,13 @@ fn metadata(&self) -> Option<StepMetadata> {
}
pub fn get_llvm_version(builder: &Builder<'_>, llvm_config: &Path) -> String {
- command(llvm_config).arg("--version").run_capture_stdout(builder).stdout().trim().to_owned()
+ command(llvm_config)
+ .arg("--version")
+ .cached()
+ .run_capture_stdout(builder)
+ .stdout()
+ .trim()
+ .to_owned()
}
pub fn get_llvm_version_major(builder: &Builder<'_>, llvm_config: &Path) -> u8 {
diff --git a/src/bootstrap/src/core/build_steps/run.rs b/src/bootstrap/src/core/build_steps/run.rs
index c6288f6..d9de6b7e 100644
--- a/src/bootstrap/src/core/build_steps/run.rs
+++ b/src/bootstrap/src/core/build_steps/run.rs
@@ -5,13 +5,14 @@
use std::path::PathBuf;
+use build_helper::exit;
use clap_complete::{Generator, shells};
use crate::core::build_steps::dist::distdir;
use crate::core::build_steps::test;
use crate::core::build_steps::tool::{self, RustcPrivateCompilers, SourceType, Tool};
use crate::core::build_steps::vendor::{Vendor, default_paths_to_vendor};
-use crate::core::builder::{Builder, Kind, RunConfig, ShouldRun, Step};
+use crate::core::builder::{Builder, Kind, RunConfig, ShouldRun, Step, StepMetadata};
use crate::core::config::TargetSelection;
use crate::core::config::flags::get_completion;
use crate::utils::exec::command;
@@ -100,8 +101,17 @@ fn run(self, builder: &Builder<'_>) -> Self::Output {
}
}
+/// Invoke the Miri tool on a specified file.
+///
+/// Note that Miri always executed on the host, as it is an interpreter.
+/// That means that `x run miri --target FOO` will build miri for the host,
+/// prepare a miri sysroot for the target `FOO` and then execute miri with
+/// the target `FOO`.
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub struct Miri {
+ /// The build compiler that will build miri and the target compiler to which miri links.
+ compilers: RustcPrivateCompilers,
+ /// The target which will miri interpret.
target: TargetSelection,
}
@@ -113,14 +123,9 @@ fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
}
fn make_run(run: RunConfig<'_>) {
- run.builder.ensure(Miri { target: run.target });
- }
+ let builder = run.builder;
- fn run(self, builder: &Builder<'_>) {
- let host = builder.build.host_target;
- let target = self.target;
-
- // `x run` uses stage 0 by default but miri does not work well with stage 0.
+ // `x run` uses stage 0 by default, but miri does not work well with stage 0.
// Change the stage to 1 if it's not set explicitly.
let stage = if builder.config.is_explicit_stage() || builder.top_stage >= 1 {
builder.top_stage
@@ -129,14 +134,22 @@ fn run(self, builder: &Builder<'_>) {
};
if stage == 0 {
- eprintln!("miri cannot be run at stage 0");
- std::process::exit(1);
+ eprintln!("ERROR: miri cannot be run at stage 0");
+ exit!(1);
}
- // This compiler runs on the host, we'll just use it for the target.
- let compilers = RustcPrivateCompilers::new(builder, stage, target);
- let miri_build = builder.ensure(tool::Miri::from_compilers(compilers));
- let host_compiler = miri_build.build_compiler;
+ // Miri always runs on the host, because it can interpret code for any target
+ let compilers = RustcPrivateCompilers::new(builder, stage, builder.host_target);
+
+ run.builder.ensure(Miri { compilers, target: run.target });
+ }
+
+ fn run(self, builder: &Builder<'_>) {
+ let host = builder.build.host_target;
+ let compilers = self.compilers;
+ let target = self.target;
+
+ builder.ensure(tool::Miri::from_compilers(compilers));
// Get a target sysroot for Miri.
let miri_sysroot =
@@ -147,7 +160,7 @@ fn run(self, builder: &Builder<'_>) {
// add_rustc_lib_path does not add the path that contains librustc_driver-<...>.so.
let mut miri = tool::prepare_tool_cargo(
builder,
- host_compiler,
+ compilers.build_compiler(),
Mode::ToolRustc,
host,
Kind::Run,
@@ -167,6 +180,10 @@ fn run(self, builder: &Builder<'_>) {
miri.into_cmd().run(builder);
}
+
+ fn metadata(&self) -> Option<StepMetadata> {
+ Some(StepMetadata::run("miri", self.target).built_by(self.compilers.build_compiler()))
+ }
}
#[derive(Debug, Clone, Hash, PartialEq, Eq)]
diff --git a/src/bootstrap/src/core/build_steps/test.rs b/src/bootstrap/src/core/build_steps/test.rs
index b527070..a6156ca 100644
--- a/src/bootstrap/src/core/build_steps/test.rs
+++ b/src/bootstrap/src/core/build_steps/test.rs
@@ -2043,6 +2043,7 @@ fn run(self, builder: &Builder<'_>) {
if !builder.config.dry_run() {
let llvm_version = get_llvm_version(builder, &host_llvm_config);
let llvm_components = command(&host_llvm_config)
+ .cached()
.arg("--components")
.run_capture_stdout(builder)
.stdout();
@@ -2062,8 +2063,11 @@ fn run(self, builder: &Builder<'_>) {
// separate compilations. We can add LLVM's library path to the
// rustc args as a workaround.
if !builder.config.dry_run() && suite.ends_with("fulldeps") {
- let llvm_libdir =
- command(&host_llvm_config).arg("--libdir").run_capture_stdout(builder).stdout();
+ let llvm_libdir = command(&host_llvm_config)
+ .cached()
+ .arg("--libdir")
+ .run_capture_stdout(builder)
+ .stdout();
let link_llvm = if target.is_msvc() {
format!("-Clink-arg=-LIBPATH:{llvm_libdir}")
} else {
diff --git a/src/bootstrap/src/core/build_steps/tool.rs b/src/bootstrap/src/core/build_steps/tool.rs
index c10b825..b62c9a9 100644
--- a/src/bootstrap/src/core/build_steps/tool.rs
+++ b/src/bootstrap/src/core/build_steps/tool.rs
@@ -1581,10 +1581,6 @@ impl Builder<'_> {
/// `host`.
pub fn tool_cmd(&self, tool: Tool) -> BootstrapCommand {
let mut cmd = command(self.tool_exe(tool));
-
- // Do not cache tool invocations, as they can have side effects
- cmd.do_not_cache();
-
let compiler = self.compiler(0, self.config.host_target);
let host = &compiler.host;
// Prepares the `cmd` provided to be able to run the `compiler` provided.
diff --git a/src/bootstrap/src/core/build_steps/vendor.rs b/src/bootstrap/src/core/build_steps/vendor.rs
index 7b860ce..0e9d4e7 100644
--- a/src/bootstrap/src/core/build_steps/vendor.rs
+++ b/src/bootstrap/src/core/build_steps/vendor.rs
@@ -19,6 +19,7 @@
pub fn default_paths_to_vendor(builder: &Builder<'_>) -> Vec<(PathBuf, Vec<&'static str>)> {
[
("src/tools/cargo/Cargo.toml", vec!["src/tools/cargo"]),
+ ("src/tools/clippy/clippy_test_deps/Cargo.toml", vec![]),
("src/tools/rust-analyzer/Cargo.toml", vec![]),
("compiler/rustc_codegen_cranelift/Cargo.toml", vec![]),
("compiler/rustc_codegen_gcc/Cargo.toml", vec![]),
diff --git a/src/bootstrap/src/core/builder/cargo.rs b/src/bootstrap/src/core/builder/cargo.rs
index 7219240..9c41795 100644
--- a/src/bootstrap/src/core/builder/cargo.rs
+++ b/src/bootstrap/src/core/builder/cargo.rs
@@ -132,10 +132,7 @@ pub fn compiler(&self) -> Compiler {
}
pub fn into_cmd(self) -> BootstrapCommand {
- let mut cmd: BootstrapCommand = self.into();
- // Disable caching for commands originating from Cargo-related operations.
- cmd.do_not_cache();
- cmd
+ self.into()
}
/// Same as [`Cargo::new`] except this one doesn't configure the linker with
@@ -1085,7 +1082,7 @@ fn cargo(
&& let Some(llvm_config) = self.llvm_config(target)
{
let llvm_libdir =
- command(llvm_config).arg("--libdir").run_capture_stdout(self).stdout();
+ command(llvm_config).cached().arg("--libdir").run_capture_stdout(self).stdout();
if target.is_msvc() {
rustflags.arg(&format!("-Clink-arg=-LIBPATH:{llvm_libdir}"));
} else {
diff --git a/src/bootstrap/src/core/builder/mod.rs b/src/bootstrap/src/core/builder/mod.rs
index 4f1bed1..27e4163 100644
--- a/src/bootstrap/src/core/builder/mod.rs
+++ b/src/bootstrap/src/core/builder/mod.rs
@@ -145,8 +145,7 @@ fn metadata(&self) -> Option<StepMetadata> {
}
/// Metadata that describes an executed step, mostly for testing and tracing.
-#[allow(unused)]
-#[derive(Debug, PartialEq, Eq)]
+#[derive(Clone, Debug, PartialEq, Eq)]
pub struct StepMetadata {
name: String,
kind: Kind,
@@ -182,6 +181,10 @@ pub fn test(name: &str, target: TargetSelection) -> Self {
Self::new(name, target, Kind::Test)
}
+ pub fn run(name: &str, target: TargetSelection) -> Self {
+ Self::new(name, target, Kind::Run)
+ }
+
fn new(name: &str, target: TargetSelection, kind: Kind) -> Self {
Self { name: name.to_string(), kind, target, built_by: None, stage: None, metadata: None }
}
diff --git a/src/bootstrap/src/core/builder/tests.rs b/src/bootstrap/src/core/builder/tests.rs
index 5260b43..f7067d1 100644
--- a/src/bootstrap/src/core/builder/tests.rs
+++ b/src/bootstrap/src/core/builder/tests.rs
@@ -1133,8 +1133,7 @@ fn dist_baseline() {
[dist] mingw <host>
[build] rustc 0 <host> -> GenerateCopyright 1 <host>
[dist] rustc <host>
- [build] rustc 2 <host> -> std 2 <host>
- [dist] rustc 2 <host> -> std 2 <host>
+ [dist] rustc 1 <host> -> std 1 <host>
[dist] rustc 1 <host> -> rustc-dev 2 <host>
[dist] src <>
[dist] reproducible-artifacts <host>
@@ -1198,8 +1197,7 @@ fn dist_extended() {
[build] rustc 1 <host> -> rust-analyzer-proc-macro-srv 2 <host>
[build] rustc 0 <host> -> GenerateCopyright 1 <host>
[dist] rustc <host>
- [build] rustc 2 <host> -> std 2 <host>
- [dist] rustc 2 <host> -> std 2 <host>
+ [dist] rustc 1 <host> -> std 1 <host>
[dist] rustc 1 <host> -> rustc-dev 2 <host>
[dist] rustc 1 <host> -> analysis 2 <host>
[dist] src <>
@@ -1216,7 +1214,6 @@ fn dist_extended() {
[build] rustc 1 <host> -> miri 2 <host>
[build] rustc 1 <host> -> cargo-miri 2 <host>
[dist] rustc 1 <host> -> miri 2 <host>
- [dist] rustc 1 <host> -> std 1 <host>
[dist] rustc 1 <host> -> extended 2 <host>
[dist] reproducible-artifacts <host>
");
@@ -1287,8 +1284,7 @@ fn dist_with_targets() {
[dist] mingw <target1>
[build] rustc 0 <host> -> GenerateCopyright 1 <host>
[dist] rustc <host>
- [build] rustc 2 <host> -> std 2 <host>
- [dist] rustc 2 <host> -> std 2 <host>
+ [dist] rustc 1 <host> -> std 1 <host>
[build] rustc 2 <host> -> std 2 <target1>
[dist] rustc 2 <host> -> std 2 <target1>
[dist] rustc 1 <host> -> rustc-dev 2 <host>
@@ -1350,8 +1346,7 @@ fn dist_with_hosts() {
[dist] rustc <host>
[build] rustdoc 2 <target1>
[dist] rustc <target1>
- [build] rustc 2 <host> -> std 2 <host>
- [dist] rustc 2 <host> -> std 2 <host>
+ [dist] rustc 1 <host> -> std 1 <host>
[dist] rustc 1 <host> -> rustc-dev 2 <host>
[dist] rustc 1 <host> -> rustc-dev 2 <target1>
[dist] src <>
@@ -1433,10 +1428,8 @@ fn dist_with_targets_and_hosts() {
[dist] rustc <host>
[build] rustdoc 2 <target1>
[dist] rustc <target1>
- [build] rustc 2 <host> -> std 2 <host>
- [dist] rustc 2 <host> -> std 2 <host>
- [build] rustc 2 <host> -> std 2 <target1>
- [dist] rustc 2 <host> -> std 2 <target1>
+ [dist] rustc 1 <host> -> std 1 <host>
+ [dist] rustc 1 <host> -> std 1 <target1>
[dist] rustc 1 <host> -> rustc-dev 2 <host>
[dist] rustc 1 <host> -> rustc-dev 2 <target1>
[dist] src <>
@@ -1490,10 +1483,8 @@ fn dist_with_empty_host() {
");
}
- /// This also serves as an important regression test for <https://github.com/rust-lang/rust/issues/138123>
- /// and <https://github.com/rust-lang/rust/issues/138004>.
#[test]
- fn dist_all_cross() {
+ fn dist_all_cross_extended() {
let ctx = TestCtx::new();
insta::assert_snapshot!(
ctx
@@ -1545,8 +1536,7 @@ fn dist_all_cross() {
[build] rustc 1 <host> -> rust-analyzer-proc-macro-srv 2 <target1>
[build] rustc 0 <host> -> GenerateCopyright 1 <host>
[dist] rustc <target1>
- [build] rustc 2 <host> -> std 2 <target1>
- [dist] rustc 2 <host> -> std 2 <target1>
+ [dist] rustc 1 <host> -> std 1 <target1>
[dist] rustc 1 <host> -> rustc-dev 2 <target1>
[dist] rustc 1 <host> -> analysis 2 <target1>
[dist] src <>
@@ -1564,15 +1554,82 @@ fn dist_all_cross() {
[build] rustc 1 <host> -> cargo-miri 2 <target1>
[dist] rustc 1 <host> -> miri 2 <target1>
[build] rustc 1 <host> -> LlvmBitcodeLinker 2 <target1>
- [dist] rustc 1 <host> -> std 1 <target1>
[doc] rustc 2 <target1> -> std 2 <target1> crates=[]
[dist] rustc 1 <host> -> extended 2 <target1>
[dist] reproducible-artifacts <target1>
");
}
- // Enable dist cranelift tarball by default with `x dist` if cranelift is enabled in
- // `rust.codegen-backends`.
+ /// Simulates e.g. the powerpc64 builder, which is fully cross-compiled from x64, but it does
+ /// not build docs. Crutically, it shouldn't build host stage 2 rustc.
+ ///
+ /// This is a regression test for <https://github.com/rust-lang/rust/issues/138123>
+ /// and <https://github.com/rust-lang/rust/issues/138004>.
+ #[test]
+ fn dist_all_cross_extended_no_docs() {
+ let ctx = TestCtx::new();
+ let steps = ctx
+ .config("dist")
+ .hosts(&[TEST_TRIPLE_1])
+ .targets(&[TEST_TRIPLE_1])
+ .args(&[
+ "--set",
+ "rust.channel=nightly",
+ "--set",
+ "build.extended=true",
+ "--set",
+ "build.docs=false",
+ ])
+ .get_steps();
+
+ // Make sure that we don't build stage2 host rustc
+ steps.assert_no_match(|m| {
+ m.name == "rustc"
+ && m.built_by.map(|b| b.stage) == Some(1)
+ && *m.target.triple == host_target()
+ });
+
+ insta::assert_snapshot!(
+ steps.render(), @r"
+ [dist] mingw <target1>
+ [build] llvm <host>
+ [build] llvm <target1>
+ [build] rustc 0 <host> -> rustc 1 <host>
+ [build] rustc 0 <host> -> WasmComponentLd 1 <host>
+ [build] rustc 1 <host> -> std 1 <target1>
+ [build] rustc 1 <host> -> std 1 <host>
+ [build] rustc 1 <host> -> rustc 2 <target1>
+ [build] rustc 1 <host> -> WasmComponentLd 2 <target1>
+ [build] rustdoc 2 <target1>
+ [build] rustc 1 <host> -> rust-analyzer-proc-macro-srv 2 <target1>
+ [build] rustc 0 <host> -> GenerateCopyright 1 <host>
+ [build] rustc 0 <host> -> RustInstaller 1 <host>
+ [dist] rustc <target1>
+ [dist] rustc 1 <host> -> std 1 <target1>
+ [dist] rustc 1 <host> -> rustc-dev 2 <target1>
+ [dist] rustc 1 <host> -> analysis 2 <target1>
+ [dist] src <>
+ [build] rustc 1 <host> -> cargo 2 <target1>
+ [dist] rustc 1 <host> -> cargo 2 <target1>
+ [build] rustc 1 <host> -> rust-analyzer 2 <target1>
+ [dist] rustc 1 <host> -> rust-analyzer 2 <target1>
+ [build] rustc 1 <host> -> rustfmt 2 <target1>
+ [build] rustc 1 <host> -> cargo-fmt 2 <target1>
+ [dist] rustc 1 <host> -> rustfmt 2 <target1>
+ [build] rustc 1 <host> -> clippy-driver 2 <target1>
+ [build] rustc 1 <host> -> cargo-clippy 2 <target1>
+ [dist] rustc 1 <host> -> clippy 2 <target1>
+ [build] rustc 1 <host> -> miri 2 <target1>
+ [build] rustc 1 <host> -> cargo-miri 2 <target1>
+ [dist] rustc 1 <host> -> miri 2 <target1>
+ [build] rustc 1 <host> -> LlvmBitcodeLinker 2 <target1>
+ [dist] rustc 1 <host> -> extended 2 <target1>
+ [dist] reproducible-artifacts <target1>
+ ");
+ }
+
+ /// Enable dist cranelift tarball by default with `x dist` if cranelift is enabled in
+ /// `rust.codegen-backends`.
#[test]
fn dist_cranelift_by_default() {
let ctx = TestCtx::new();
@@ -1619,8 +1676,7 @@ fn dist_cranelift_by_default() {
[build] rustc 0 <host> -> GenerateCopyright 1 <host>
[dist] rustc <host>
[dist] rustc 1 <host> -> rustc_codegen_cranelift 2 <host>
- [build] rustc 2 <host> -> std 2 <host>
- [dist] rustc 2 <host> -> std 2 <host>
+ [dist] rustc 1 <host> -> std 1 <host>
[dist] rustc 1 <host> -> rustc-dev 2 <host>
[dist] src <>
[dist] reproducible-artifacts <host>
@@ -2351,8 +2407,7 @@ fn install_extended() {
[doc] rustc 1 <host> -> releases 2 <host>
[build] rustc 0 <host> -> RustInstaller 1 <host>
[dist] docs <host>
- [build] rustc 2 <host> -> std 2 <host>
- [dist] rustc 2 <host> -> std 2 <host>
+ [dist] rustc 1 <host> -> std 1 <host>
[build] rustc 1 <host> -> rust-analyzer-proc-macro-srv 2 <host>
[build] rustc 0 <host> -> GenerateCopyright 1 <host>
[dist] rustc <host>
@@ -2372,6 +2427,24 @@ fn install_extended() {
[dist] src <>
");
}
+
+ // Check that `x run miri --target FOO` actually builds miri for the host.
+ #[test]
+ fn run_miri() {
+ let ctx = TestCtx::new();
+ insta::assert_snapshot!(
+ ctx.config("run")
+ .path("miri")
+ .stage(1)
+ .targets(&[TEST_TRIPLE_1])
+ .render_steps(), @r"
+ [build] llvm <host>
+ [build] rustc 0 <host> -> rustc 1 <host>
+ [build] rustc 0 <host> -> miri 1 <host>
+ [build] rustc 0 <host> -> cargo-miri 1 <host>
+ [run] rustc 0 <host> -> miri 1 <target1>
+ ");
+ }
}
struct ExecutedSteps {
@@ -2426,6 +2499,21 @@ fn assert_not_contains<M: Into<StepMetadata>>(&self, metadata: M) {
}
}
+ /// Make sure that no metadata matches the given `func`.
+ #[track_caller]
+ fn assert_no_match<F>(&self, func: F)
+ where
+ F: Fn(StepMetadata) -> bool,
+ {
+ for metadata in self.steps.iter().filter_map(|s| s.metadata.clone()) {
+ if func(metadata.clone()) {
+ panic!(
+ "Metadata {metadata:?} was found, even though it should have not been present"
+ );
+ }
+ }
+ }
+
fn contains(&self, metadata: &StepMetadata) -> bool {
self.steps
.iter()
diff --git a/src/bootstrap/src/core/config/config.rs b/src/bootstrap/src/core/config/config.rs
index e5c2e3c..3e9c8cc 100644
--- a/src/bootstrap/src/core/config/config.rs
+++ b/src/bootstrap/src/core/config/config.rs
@@ -960,8 +960,8 @@ pub(crate) fn parse_inner(
Subcommand::Dist => flags_stage.or(build_dist_stage).unwrap_or(2),
Subcommand::Install => flags_stage.or(build_install_stage).unwrap_or(2),
Subcommand::Perf { .. } => flags_stage.unwrap_or(1),
- // These are all bootstrap tools, which don't depend on the compiler.
- // The stage we pass shouldn't matter, but use 0 just in case.
+ // Most of the run commands execute bootstrap tools, which don't depend on the compiler.
+ // Other commands listed here should always use bootstrap tools.
Subcommand::Clean { .. }
| Subcommand::Run { .. }
| Subcommand::Setup { .. }
diff --git a/src/bootstrap/src/core/sanity.rs b/src/bootstrap/src/core/sanity.rs
index 4916ebb..099ec48 100644
--- a/src/bootstrap/src/core/sanity.rs
+++ b/src/bootstrap/src/core/sanity.rs
@@ -34,6 +34,7 @@ pub struct Finder {
// Targets can be removed from this list once they are present in the stage0 compiler (usually by updating the beta compiler of the bootstrap).
const STAGE0_MISSING_TARGETS: &[&str] = &[
"armv7a-vex-v5",
+ "riscv64a23-unknown-linux-gnu",
// just a dummy comment so the list doesn't get onelined
"aarch64_be-unknown-hermit",
"aarch64_be-unknown-none-softfloat",
diff --git a/src/bootstrap/src/utils/exec.rs b/src/bootstrap/src/utils/exec.rs
index 9a536f7..e09f308 100644
--- a/src/bootstrap/src/utils/exec.rs
+++ b/src/bootstrap/src/utils/exec.rs
@@ -264,8 +264,11 @@ pub fn arg<S: AsRef<OsStr>>(&mut self, arg: S) -> &mut Self {
self
}
- pub fn do_not_cache(&mut self) -> &mut Self {
- self.should_cache = false;
+ /// Cache the command. If it will be executed multiple times with the exact same arguments
+ /// and environment variables in the same bootstrap invocation, the previous result will be
+ /// loaded from memory.
+ pub fn cached(&mut self) -> &mut Self {
+ self.should_cache = true;
self
}
@@ -425,7 +428,7 @@ impl From<Command> for BootstrapCommand {
fn from(command: Command) -> Self {
let program = command.get_program().to_owned();
Self {
- should_cache: true,
+ should_cache: false,
command,
failure_behavior: BehaviorOnFailure::Exit,
run_in_dry_run: false,
diff --git a/src/bootstrap/src/utils/helpers.rs b/src/bootstrap/src/utils/helpers.rs
index 4514827..e802c02 100644
--- a/src/bootstrap/src/utils/helpers.rs
+++ b/src/bootstrap/src/utils/helpers.rs
@@ -510,6 +510,8 @@ pub fn check_cfg_arg(name: &str, values: Option<&[&str]>) -> String {
#[track_caller]
pub fn git(source_dir: Option<&Path>) -> BootstrapCommand {
let mut git = command("git");
+ // git commands are almost always read-only, so cache them by default
+ git.cached();
if let Some(source_dir) = source_dir {
git.current_dir(source_dir);
diff --git a/src/doc/rustc/src/SUMMARY.md b/src/doc/rustc/src/SUMMARY.md
index b53494ed9..e0d637a 100644
--- a/src/doc/rustc/src/SUMMARY.md
+++ b/src/doc/rustc/src/SUMMARY.md
@@ -49,6 +49,7 @@
- [aarch64-nintendo-switch-freestanding](platform-support/aarch64-nintendo-switch-freestanding.md)
- [aarch64-unknown-linux-musl](platform-support/aarch64-unknown-linux-musl.md)
- [aarch64_be-unknown-none-softfloat](platform-support/aarch64_be-unknown-none-softfloat.md)
+ - [aarch64_be-unknown-linux-musl](platform-support/aarch64_be-unknown-linux-musl.md)
- [amdgcn-amd-amdhsa](platform-support/amdgcn-amd-amdhsa.md)
- [armeb-unknown-linux-gnueabi](platform-support/armeb-unknown-linux-gnueabi.md)
- [arm-none-eabi](platform-support/arm-none-eabi.md)
@@ -106,6 +107,7 @@
- [riscv32imac-unknown-xous-elf](platform-support/riscv32imac-unknown-xous-elf.md)
- [riscv64gc-unknown-linux-gnu](platform-support/riscv64gc-unknown-linux-gnu.md)
- [riscv64gc-unknown-linux-musl](platform-support/riscv64gc-unknown-linux-musl.md)
+ - [riscv64a23-unknown-linux-gnu](platform-support/riscv64a23-unknown-linux-gnu.md)
- [s390x-unknown-linux-gnu](platform-support/s390x-unknown-linux-gnu.md)
- [s390x-unknown-linux-musl](platform-support/s390x-unknown-linux-musl.md)
- [sparc-unknown-none-elf](./platform-support/sparc-unknown-none-elf.md)
diff --git a/src/doc/rustc/src/images/image1.png b/src/doc/rustc/src/images/image1.png
index 0da45e5..3aad635 100644
--- a/src/doc/rustc/src/images/image1.png
+++ b/src/doc/rustc/src/images/image1.png
Binary files differ
diff --git a/src/doc/rustc/src/images/image2.png b/src/doc/rustc/src/images/image2.png
index a9cf23f..085b1c4 100644
--- a/src/doc/rustc/src/images/image2.png
+++ b/src/doc/rustc/src/images/image2.png
Binary files differ
diff --git a/src/doc/rustc/src/images/image3.png b/src/doc/rustc/src/images/image3.png
index 844a2fe..ee332f5 100644
--- a/src/doc/rustc/src/images/image3.png
+++ b/src/doc/rustc/src/images/image3.png
Binary files differ
diff --git a/src/doc/rustc/src/images/llvm-cov-show-01.png b/src/doc/rustc/src/images/llvm-cov-show-01.png
index 35f0459..ce4dec1 100644
--- a/src/doc/rustc/src/images/llvm-cov-show-01.png
+++ b/src/doc/rustc/src/images/llvm-cov-show-01.png
Binary files differ
diff --git a/src/doc/rustc/src/platform-support.md b/src/doc/rustc/src/platform-support.md
index 3bf8799..22d32a2 100644
--- a/src/doc/rustc/src/platform-support.md
+++ b/src/doc/rustc/src/platform-support.md
@@ -273,6 +273,7 @@
[`aarch64_be-unknown-hermit`](platform-support/hermit.md) | ✓ | | ARM64 Hermit (big-endian)
`aarch64_be-unknown-linux-gnu` | ✓ | ✓ | ARM64 Linux (big-endian)
`aarch64_be-unknown-linux-gnu_ilp32` | ✓ | ✓ | ARM64 Linux (big-endian, ILP32 ABI)
+[`aarch64_be-unknown-linux-musl`](platform-support/aarch64_be-unknown-linux-musl.md) | ✓ | ✓ | ARM64 Linux (big-endian) with musl-libc 1.2.5
[`aarch64_be-unknown-netbsd`](platform-support/netbsd.md) | ✓ | ✓ | ARM64 NetBSD (big-endian)
[`aarch64_be-unknown-none-softfloat`](platform-support/aarch64_be-unknown-none-softfloat.md) | * | | Bare big-endian ARM64, softfloat
[`amdgcn-amd-amdhsa`](platform-support/amdgcn-amd-amdhsa.md) | * | | `-Ctarget-cpu=gfx...` to specify [the AMD GPU] to compile for
@@ -391,6 +392,7 @@
[`riscv64gc-unknown-nuttx-elf`](platform-support/nuttx.md) | ✓ | | RISC-V 64bit with NuttX
[`riscv64gc-unknown-openbsd`](platform-support/openbsd.md) | ✓ | ✓ | OpenBSD/riscv64
[`riscv64imac-unknown-nuttx-elf`](platform-support/nuttx.md) | ✓ | | RISC-V 64bit with NuttX
+[`riscv64a23-unknown-linux-gnu`](platform-support/riscv64a23-unknown-linux-gnu.md) | ✓ | ✓ | RISC-V Linux (kernel 6.8.0+, glibc 2.39)
[`s390x-unknown-linux-musl`](platform-support/s390x-unknown-linux-musl.md) | ✓ | | S390x Linux (kernel 3.2, musl 1.2.3)
`sparc-unknown-linux-gnu` | ✓ | | 32-bit SPARC Linux
[`sparc-unknown-none-elf`](./platform-support/sparc-unknown-none-elf.md) | * | | Bare 32-bit SPARC V7+
diff --git a/src/doc/rustc/src/platform-support/aarch64_be-unknown-linux-musl.md b/src/doc/rustc/src/platform-support/aarch64_be-unknown-linux-musl.md
new file mode 100644
index 0000000..3e816dc
--- /dev/null
+++ b/src/doc/rustc/src/platform-support/aarch64_be-unknown-linux-musl.md
@@ -0,0 +1,49 @@
+# aarch64_be-unknown-linux-musl
+
+**Tier: 3**
+
+ARM64 Linux (big-endian) with musl-libc.
+
+## Target maintainers
+
+[@neuschaefer](https://github.com/neuschaefer)
+[@Gelbpunkt](https://github.com/Gelbpunkt)
+
+## Requirements
+
+The target requires a `aarch64_be-*-linux-musl` toolchain, which likely has to
+be built from source because this is a rare combination. [Buildroot] provides
+a way of doing so:
+
+- select _Target options_ → _Target Architecture_ → _AArch64 (big endian)_
+- select _Toolchain_ → _C library_ → _musl_
+- select _Toolchain_ → _Enable C++ support_
+
+Host tools are supported.
+
+[Buildroot]: https://buildroot.org/
+
+
+## Building the target
+
+The target can be enabled in bootstrap.toml:
+
+```toml
+[build]
+target = ["aarch64_be-unknown-linux-musl"]
+
+[target.aarch64_be-unknown-linux-musl]
+cc = "/path/to/buildroot/host/bin/aarch64_be-buildroot-linux-musl-cc"
+cxx = "/path/to/buildroot/host/bin/aarch64_be-buildroot-linux-musl-c++"
+linker = "/path/to/buildroot/host/bin/aarch64_be-buildroot-linux-musl-cc"
+ar = "/path/to/buildroot/host/bin/aarch64_be-buildroot-linux-musl-ar"
+ranlib = "/path/to/buildroot/host/bin/aarch64_be-buildroot-linux-musl-ranlib"
+musl-root = "/path/to/buildroot/staging"
+runner = "qemu-aarch64_be -L /path/to/buildroot/target"
+crt-static = "/path/to/buildroot/target"
+```
+
+
+## Testing
+
+Binaries can be run under `qemu-aarch64_be` or under a big-endian Linux kernel.
diff --git a/src/doc/rustc/src/platform-support/riscv64a23-unknown-linux-gnu.md b/src/doc/rustc/src/platform-support/riscv64a23-unknown-linux-gnu.md
new file mode 100644
index 0000000..2cbaaa8
--- /dev/null
+++ b/src/doc/rustc/src/platform-support/riscv64a23-unknown-linux-gnu.md
@@ -0,0 +1,41 @@
+# `riscv64a23-unknown-linux-gnu`
+
+**Tier: 3**
+
+RISC-V target using the ratified [RVA23 Profile](https://github.com/riscv/riscv-profiles/blob/main/src/rva23-profile.adoc).
+This target will enable all mandary features of rva23u64 by default.
+
+## Target maintainers
+
+[@ZhongyaoChen](https://github.com/ZhongyaoChen)
+[@CaiWeiran](https://github.com/CaiWeiran)
+
+## Requirements
+
+This target can be sucessfully build on the following platform: ubuntu 24.04 (Linux Kernel version 6.8.0, glibc 2.39).
+
+Other platforms may work, but are not tested. Please contanct if you encounter any issues.
+
+## Building the target
+
+Tier-3 target is not distributed through `rustup`.
+
+You need to build your own Rust, the target can be build with:
+
+```bash
+./x build --target riscv64a23-unknown-linux-gnu
+```
+
+## Building Rust programs
+
+Add the toolchain:
+
+```bash
+rustup toolchain link rva23-toolchain {path-to-rust}/build/host/stage2
+```
+
+Then cross compile crates with:
+
+```bash
+RUSTFLAGS="-C linker=riscv64-linux-gnu-gcc" cargo +rva23-toolchain build --target=riscv64a23-unknown-linux-gnu
+```
diff --git a/src/doc/rustdoc/src/images/collapsed-long-item.png b/src/doc/rustdoc/src/images/collapsed-long-item.png
index c382870..6de759f 100644
--- a/src/doc/rustdoc/src/images/collapsed-long-item.png
+++ b/src/doc/rustdoc/src/images/collapsed-long-item.png
Binary files differ
diff --git a/src/doc/rustdoc/src/images/collapsed-trait-impls.png b/src/doc/rustdoc/src/images/collapsed-trait-impls.png
index f685656..96cc7db 100644
--- a/src/doc/rustdoc/src/images/collapsed-trait-impls.png
+++ b/src/doc/rustdoc/src/images/collapsed-trait-impls.png
Binary files differ
diff --git a/src/etc/installer/gfx/rust-logo.png b/src/etc/installer/gfx/rust-logo.png
index 99ee750..49d8d0d 100644
--- a/src/etc/installer/gfx/rust-logo.png
+++ b/src/etc/installer/gfx/rust-logo.png
Binary files differ
diff --git a/src/librustdoc/html/static/images/favicon-32x32.png b/src/librustdoc/html/static/images/favicon-32x32.png
index 69b8613..0670c4d 100644
--- a/src/librustdoc/html/static/images/favicon-32x32.png
+++ b/src/librustdoc/html/static/images/favicon-32x32.png
Binary files differ
diff --git a/tests/assembly-llvm/targets/targets-elf.rs b/tests/assembly-llvm/targets/targets-elf.rs
index 79347d0..c935a75 100644
--- a/tests/assembly-llvm/targets/targets-elf.rs
+++ b/tests/assembly-llvm/targets/targets-elf.rs
@@ -10,6 +10,9 @@
//@ revisions: aarch64_be_unknown_linux_gnu_ilp32
//@ [aarch64_be_unknown_linux_gnu_ilp32] compile-flags: --target aarch64_be-unknown-linux-gnu_ilp32
//@ [aarch64_be_unknown_linux_gnu_ilp32] needs-llvm-components: aarch64
+//@ revisions: aarch64_be_unknown_linux_musl
+//@ [aarch64_be_unknown_linux_musl] compile-flags: --target aarch64_be-unknown-linux-musl
+//@ [aarch64_be_unknown_linux_musl] needs-llvm-components: aarch64
//@ revisions: aarch64_be_unknown_netbsd
//@ [aarch64_be_unknown_netbsd] compile-flags: --target aarch64_be-unknown-netbsd
//@ [aarch64_be_unknown_netbsd] needs-llvm-components: aarch64
@@ -481,6 +484,9 @@
//@ revisions: riscv64gc_unknown_linux_gnu
//@ [riscv64gc_unknown_linux_gnu] compile-flags: --target riscv64gc-unknown-linux-gnu
//@ [riscv64gc_unknown_linux_gnu] needs-llvm-components: riscv
+//@ revisions: riscv64a23_unknown_linux_gnu
+//@ [riscv64a23_unknown_linux_gnu] compile-flags: --target riscv64a23-unknown-linux-gnu
+//@ [riscv64a23_unknown_linux_gnu] needs-llvm-components: riscv
//@ revisions: riscv64gc_unknown_linux_musl
//@ [riscv64gc_unknown_linux_musl] compile-flags: --target riscv64gc-unknown-linux-musl
//@ [riscv64gc_unknown_linux_musl] needs-llvm-components: riscv
diff --git a/tests/ui/check-cfg/target_feature.stderr b/tests/ui/check-cfg/target_feature.stderr
index f644814..258f213 100644
--- a/tests/ui/check-cfg/target_feature.stderr
+++ b/tests/ui/check-cfg/target_feature.stderr
@@ -243,6 +243,7 @@
`relax`
`relaxed-simd`
`rtm`
+`rva23u64`
`sb`
`scq`
`sha`
@@ -304,6 +305,7 @@
`ssve-fp8dot2`
`ssve-fp8dot4`
`ssve-fp8fma`
+`supm`
`sve`
`sve-b16b16`
`sve2`
diff --git a/tests/ui/const-generics/adt_const_params/const_param_ty_bad.stderr b/tests/ui/const-generics/adt_const_params/const_param_ty_bad.stderr
index 4c8a5e4..c05584e 100644
--- a/tests/ui/const-generics/adt_const_params/const_param_ty_bad.stderr
+++ b/tests/ui/const-generics/adt_const_params/const_param_ty_bad.stderr
@@ -32,8 +32,9 @@
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `check`
help: use parentheses to call this closure
|
-LL | check(|| {}());
- | ++
+LL - check(|| {});
+LL + check((|| {})());
+ |
error[E0277]: `fn()` can't be used as a const parameter type
--> $DIR/const_param_ty_bad.rs:9:11
diff --git a/tests/ui/resolve/issue-102946.rs b/tests/ui/resolve/issue-102946.rs
index c6feca6..8d90e61 100644
--- a/tests/ui/resolve/issue-102946.rs
+++ b/tests/ui/resolve/issue-102946.rs
@@ -1,7 +1,6 @@
impl Error for str::Utf8Error {
//~^ ERROR cannot find trait `Error` in this scope
//~| ERROR ambiguous associated type
- fn description(&self) {}
}
fn main() {}
diff --git a/tests/ui/suggestions/use-parentheses-to-call-closure-issue-145404.fixed b/tests/ui/suggestions/use-parentheses-to-call-closure-issue-145404.fixed
new file mode 100644
index 0000000..2835743
--- /dev/null
+++ b/tests/ui/suggestions/use-parentheses-to-call-closure-issue-145404.fixed
@@ -0,0 +1,13 @@
+//@ run-rustfix
+
+use std::fmt::Display;
+
+struct S;
+
+impl S {
+ fn call(&self, _: impl Display) {}
+}
+
+fn main() {
+ S.call((|| "hello")()); //~ ERROR [E0277]
+}
diff --git a/tests/ui/suggestions/use-parentheses-to-call-closure-issue-145404.rs b/tests/ui/suggestions/use-parentheses-to-call-closure-issue-145404.rs
new file mode 100644
index 0000000..848629a
--- /dev/null
+++ b/tests/ui/suggestions/use-parentheses-to-call-closure-issue-145404.rs
@@ -0,0 +1,13 @@
+//@ run-rustfix
+
+use std::fmt::Display;
+
+struct S;
+
+impl S {
+ fn call(&self, _: impl Display) {}
+}
+
+fn main() {
+ S.call(|| "hello"); //~ ERROR [E0277]
+}
diff --git a/tests/ui/suggestions/use-parentheses-to-call-closure-issue-145404.stderr b/tests/ui/suggestions/use-parentheses-to-call-closure-issue-145404.stderr
new file mode 100644
index 0000000..cb6df5a
--- /dev/null
+++ b/tests/ui/suggestions/use-parentheses-to-call-closure-issue-145404.stderr
@@ -0,0 +1,23 @@
+error[E0277]: `{closure@$DIR/use-parentheses-to-call-closure-issue-145404.rs:12:12: 12:14}` doesn't implement `std::fmt::Display`
+ --> $DIR/use-parentheses-to-call-closure-issue-145404.rs:12:12
+ |
+LL | S.call(|| "hello");
+ | ---- ^^^^^^^^^^ unsatisfied trait bound
+ | |
+ | required by a bound introduced by this call
+ |
+ = help: the trait `std::fmt::Display` is not implemented for closure `{closure@$DIR/use-parentheses-to-call-closure-issue-145404.rs:12:12: 12:14}`
+note: required by a bound in `S::call`
+ --> $DIR/use-parentheses-to-call-closure-issue-145404.rs:8:28
+ |
+LL | fn call(&self, _: impl Display) {}
+ | ^^^^^^^ required by this bound in `S::call`
+help: use parentheses to call this closure
+ |
+LL - S.call(|| "hello");
+LL + S.call((|| "hello")());
+ |
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/type-alias-impl-trait/issue-87455-static-lifetime-ice.rs b/tests/ui/type-alias-impl-trait/issue-87455-static-lifetime-ice.rs
index 987fad2..476babd 100644
--- a/tests/ui/type-alias-impl-trait/issue-87455-static-lifetime-ice.rs
+++ b/tests/ui/type-alias-impl-trait/issue-87455-static-lifetime-ice.rs
@@ -1,6 +1,6 @@
//@ check-pass
-use std::error::Error as StdError;
+use std::error::Error;
use std::pin::Pin;
use std::task::{Context, Poll};
@@ -51,7 +51,7 @@ impl<S> Stream for SseKeepAlive<S>
where
S: TryStream + Send + 'static,
S::Ok: ServerSentEvent,
- S::Error: StdError + Send + Sync + 'static,
+ S::Error: Error + Send + Sync + 'static,
{
type Item = Result<SseComment<&'static str>, ()>;
fn poll_next(self: Pin<&mut Self>, _cx: &mut Context) -> Poll<Option<Self::Item>> {
@@ -65,7 +65,7 @@ pub fn keep<S>(
where
S: TryStream + Send + 'static,
S::Ok: ServerSentEvent + Send,
- S::Error: StdError + Send + Sync + 'static,
+ S::Error: Error + Send + Sync + 'static,
{
SseKeepAlive { event_stream }
}