Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
a4cf5e9
Add new Tier-3 target: riscv64a23-unknown-linux-gnu
ZhongyaoChen Jul 14, 2025
988cd14
Add a disabled builder for riscv64 rva23 emulated tests
ZhongyaoChen Jul 21, 2025
31ae666
Add target page for riscv64a23-unknown-linux-gnu
ZhongyaoChen Jul 29, 2025
93a8c1d
Update src/doc/rustc/src/platform-support/riscv64a23-unknown-linux-gn…
ZhongyaoChen Aug 8, 2025
87fd289
Revert "Add a disabled builder for riscv64 rva23 emulated tests"
ZhongyaoChen Aug 9, 2025
57feb7f
old testcase output
mu001999 Aug 16, 2025
5e8c2c3
Add parentheses for closure when suggesting calling closure
mu001999 Aug 16, 2025
224fd13
change riscv64a23 target reqirements comments: linux kernel 6.8.0, gl…
ZhongyaoChen Aug 18, 2025
ce07b5d
remove rva23s64 from riscv64a23-unknown-linux-gnu target
ZhongyaoChen Aug 19, 2025
45ea228
completely remove rva23s64
ZhongyaoChen Aug 19, 2025
a21d7d7
Fix doc of `std::os::windows::io::BorrowedSocket::borrow_raw`
lorenzleutgeb Aug 19, 2025
70e7c05
Losslessly optimize PNG files
lumiscosity Aug 19, 2025
199e54c
Add aarch64_be-unknown-linux-musl target
neuschaefer Jul 18, 2025
c73d7ae
bootstrap: vendor `clippy_test_deps` too
cuviper Aug 25, 2025
575a90e
formatting_options: Make all methods `const`
EliasHolzmann Aug 25, 2025
fcff8f7
Assert that LLVM range-attribute values don't exceed 128 bits
Zalathar Aug 26, 2025
0781c47
Always build miri for the host in `x run miri`
Kobzol Aug 25, 2025
845311a
remove deprecated Error::description in impls
hkBst Aug 23, 2025
7379ff2
Make bootstrap command caching opt-in
Kobzol Aug 25, 2025
2fd6057
Cache LLVM config invocations
Kobzol Aug 25, 2025
9bb7d17
Rollup merge of #144373 - hkBst:remove-deprecated-1, r=jhpratt
GuillaumeGomez Aug 26, 2025
5a74ce8
Rollup merge of #144551 - neuschaefer:a64be-musl, r=davidtwco
GuillaumeGomez Aug 26, 2025
879bb22
Rollup merge of #145076 - ZhongyaoChen:feature/add-tier3-riscv64a23-t…
GuillaumeGomez Aug 26, 2025
2708b26
Rollup merge of #145481 - mu001999-contrib:fix/closure-sugg, r=Sparro…
GuillaumeGomez Aug 26, 2025
c7e6f46
Rollup merge of #145596 - lumiscosity:optimize-png-files, r=davidtwco
GuillaumeGomez Aug 26, 2025
64fcb75
Rollup merge of #145615 - lorenzleutgeb:socket-doc, r=ChrisDenton
GuillaumeGomez Aug 26, 2025
2ac7fdd
Rollup merge of #145841 - Kobzol:fix-miri-run, r=jieyouxu
GuillaumeGomez Aug 26, 2025
20a3e45
Rollup merge of #145861 - cuviper:vendor-clippy, r=Kobzol
GuillaumeGomez Aug 26, 2025
5d95ec0
Rollup merge of #145863 - EliasHolzmann:formatting_options_20250825, …
GuillaumeGomez Aug 26, 2025
6047243
Rollup merge of #145867 - Zalathar:range-attr, r=nikic
GuillaumeGomez Aug 26, 2025
0f30dcc
Rollup merge of #145875 - Kobzol:bootstrap-caching, r=jieyouxu
GuillaumeGomez Aug 26, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions compiler/rustc_codegen_llvm/src/llvm/ffi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1929,11 +1929,17 @@ unsafe extern "C" {
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
Expand Down
26 changes: 18 additions & 8 deletions compiler/rustc_codegen_llvm/src/llvm/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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())
}
}

Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_llvm/src/llvm_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
3 changes: 3 additions & 0 deletions compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,9 @@ extern "C" LLVMAttributeRef
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);
}
Expand Down
2 changes: 2 additions & 0 deletions compiler/rustc_target/src/spec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1954,6 +1954,7 @@ supported_targets! {
("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),
Expand Down Expand Up @@ -2149,6 +2150,7 @@ supported_targets! {
("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),

Expand Down
Original file line number Diff line number Diff line change
@@ -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
},
}
}
Original file line number Diff line number Diff line change
@@ -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()
},
}
}
43 changes: 43 additions & 0 deletions compiler/rustc_target/src/target_features.rs
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,49 @@ static RISCV_FEATURES: &[(&str, Stability, ImpliedFeatures)] = &[
),
("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"]),
Expand Down
15 changes: 3 additions & 12 deletions compiler/rustc_thread_pool/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -787,18 +787,7 @@ impl ThreadPoolBuildError {
}
}

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,
Expand All @@ -810,7 +799,9 @@ impl Error for ThreadPoolBuildError {
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),
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -820,16 +820,20 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
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 {
Expand Down
5 changes: 0 additions & 5 deletions library/alloc/src/boxed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2128,11 +2128,6 @@ impl<F: ?Sized + Future + Unpin, A: Allocator> Future for Box<F, A> {

#[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)
Expand Down
7 changes: 1 addition & 6 deletions library/alloc/src/boxed/convert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 0 additions & 4 deletions library/alloc/src/collections/btree/map/entry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,6 @@ impl<'a, K: Debug + Ord, V: Debug, A: Allocator + Clone> fmt::Display
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> {
Expand Down
21 changes: 2 additions & 19 deletions library/alloc/src/ffi/c_str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1061,17 +1061,10 @@ impl IntoStringError {
}
}

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)
}
}

Expand Down Expand Up @@ -1291,23 +1284,13 @@ impl PartialEq<CString> for Cow<'_, CStr> {
}

#[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)
}
Expand Down
14 changes: 2 additions & 12 deletions library/alloc/src/string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2285,20 +2285,10 @@ impl fmt::Display for FromUtf16Error {
}

#[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")]
Expand Down
5 changes: 0 additions & 5 deletions library/alloc/src/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4113,11 +4113,6 @@ impl<T: ?Sized, A: Allocator> Drop for UniqueArcUninit<T, A> {

#[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)
Expand Down
Loading
Loading