Skip to content

Commit db1a31c

Browse files
authored
Merge pull request #650 from rust-lang/sync_from_rust_2025_04_17
Sync from rust 2025/04/17
2 parents 499de70 + 52b0687 commit db1a31c

Some content is hidden

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

51 files changed

+933
-843
lines changed

Diff for: build_system/src/test.rs

+1-27
Original file line numberDiff line numberDiff line change
@@ -426,19 +426,6 @@ fn std_tests(env: &Env, args: &TestArg) -> Result<(), String> {
426426
run_command_with_env(&command, None, Some(env))?;
427427
maybe_run_command_in_vm(&[&cargo_target_dir.join("track-caller-attribute")], env, args)?;
428428

429-
// FIXME: create a function "display_if_not_quiet" or something along the line.
430-
println!("[AOT] mod_bench");
431-
let mut command = args.config_info.rustc_command_vec();
432-
command.extend_from_slice(&[
433-
&"example/mod_bench.rs",
434-
&"--crate-type",
435-
&"bin",
436-
&"--target",
437-
&args.config_info.target_triple,
438-
]);
439-
run_command_with_env(&command, None, Some(env))?;
440-
// FIXME: the compiled binary is not run.
441-
442429
Ok(())
443430
}
444431

@@ -691,25 +678,12 @@ fn test_projects(env: &Env, args: &TestArg) -> Result<(), String> {
691678
fn test_libcore(env: &Env, args: &TestArg) -> Result<(), String> {
692679
// FIXME: create a function "display_if_not_quiet" or something along the line.
693680
println!("[TEST] libcore");
694-
let path = get_sysroot_dir().join("sysroot_src/library/core/tests");
681+
let path = get_sysroot_dir().join("sysroot_src/library/coretests");
695682
let _ = remove_dir_all(path.join("target"));
696683
run_cargo_command(&[&"test"], Some(&path), env, args)?;
697684
Ok(())
698685
}
699686

700-
// echo "[BENCH COMPILE] mod_bench"
701-
//
702-
// COMPILE_MOD_BENCH_INLINE="$RUSTC example/mod_bench.rs --crate-type bin -Zmir-opt-level=3 -O --crate-name mod_bench_inline"
703-
// COMPILE_MOD_BENCH_LLVM_0="rustc example/mod_bench.rs --crate-type bin -Copt-level=0 -o $cargo_target_dir/mod_bench_llvm_0 -Cpanic=abort"
704-
// COMPILE_MOD_BENCH_LLVM_1="rustc example/mod_bench.rs --crate-type bin -Copt-level=1 -o $cargo_target_dir/mod_bench_llvm_1 -Cpanic=abort"
705-
// COMPILE_MOD_BENCH_LLVM_2="rustc example/mod_bench.rs --crate-type bin -Copt-level=2 -o $cargo_target_dir/mod_bench_llvm_2 -Cpanic=abort"
706-
// COMPILE_MOD_BENCH_LLVM_3="rustc example/mod_bench.rs --crate-type bin -Copt-level=3 -o $cargo_target_dir/mod_bench_llvm_3 -Cpanic=abort"
707-
//
708-
// Use 100 runs, because a single compilations doesn't take more than ~150ms, so it isn't very slow
709-
// hyperfine --runs ${COMPILE_RUNS:-100} "$COMPILE_MOD_BENCH_INLINE" "$COMPILE_MOD_BENCH_LLVM_0" "$COMPILE_MOD_BENCH_LLVM_1" "$COMPILE_MOD_BENCH_LLVM_2" "$COMPILE_MOD_BENCH_LLVM_3"
710-
// echo "[BENCH RUN] mod_bench"
711-
// hyperfine --runs ${RUN_RUNS:-10} $cargo_target_dir/mod_bench{,_inline} $cargo_target_dir/mod_bench_llvm_*
712-
713687
fn extended_rand_tests(env: &Env, args: &TestArg) -> Result<(), String> {
714688
if !args.is_using_gcc_master_branch() {
715689
println!("Not using GCC master branch. Skipping `extended_rand_tests`.");

Diff for: example/alloc_example.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
#![feature(start, core_intrinsics, alloc_error_handler, lang_items)]
1+
#![feature(core_intrinsics, alloc_error_handler, lang_items)]
22
#![no_std]
3+
#![no_main]
34
#![allow(internal_features)]
45

56
extern crate alloc;
@@ -37,8 +38,8 @@ unsafe extern "C" fn _Unwind_Resume() {
3738
core::intrinsics::unreachable();
3839
}
3940

40-
#[start]
41-
fn main(_argc: isize, _argv: *const *const u8) -> isize {
41+
#[no_mangle]
42+
extern "C" fn main(_argc: core::ffi::c_int, _argv: *const *const u8) -> core::ffi::c_int {
4243
let world: Box<&str> = Box::new("Hello World!\0");
4344
unsafe {
4445
puts(*world as *const str as *const u8);

Diff for: example/mini_core.rs

+28-21
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ trait Receiver {
5858
#[lang = "copy"]
5959
pub trait Copy {}
6060

61+
#[lang = "bikeshed_guaranteed_no_drop"]
62+
pub trait BikeshedGuaranteedNoDrop {}
63+
6164
impl Copy for bool {}
6265
impl Copy for u8 {}
6366
impl Copy for u16 {}
@@ -135,6 +138,14 @@ impl Mul for u8 {
135138
}
136139
}
137140

141+
impl Mul for i32 {
142+
type Output = Self;
143+
144+
fn mul(self, rhs: Self) -> Self::Output {
145+
self * rhs
146+
}
147+
}
148+
138149
impl Mul for usize {
139150
type Output = Self;
140151

@@ -245,6 +256,14 @@ impl Sub for i16 {
245256
}
246257
}
247258

259+
impl Sub for i32 {
260+
type Output = Self;
261+
262+
fn sub(self, rhs: Self) -> Self {
263+
self - rhs
264+
}
265+
}
266+
248267
#[lang = "rem"]
249268
pub trait Rem<RHS = Self> {
250269
type Output;
@@ -617,40 +636,28 @@ pub union MaybeUninit<T> {
617636
pub mod intrinsics {
618637
#[rustc_intrinsic]
619638
pub fn abort() -> !;
620-
621639
#[rustc_intrinsic]
622640
pub fn size_of<T>() -> usize;
623-
624641
#[rustc_intrinsic]
625-
pub unsafe fn size_of_val<T: ?::Sized>(_val: *const T) -> usize;
626-
642+
pub unsafe fn size_of_val<T: ?::Sized>(val: *const T) -> usize;
627643
#[rustc_intrinsic]
628644
pub fn min_align_of<T>() -> usize;
629-
630645
#[rustc_intrinsic]
631-
pub unsafe fn min_align_of_val<T: ?::Sized>(_val: *const T) -> usize;
632-
646+
pub unsafe fn min_align_of_val<T: ?::Sized>(val: *const T) -> usize;
633647
#[rustc_intrinsic]
634-
pub unsafe fn copy<T>(_src: *const T, _dst: *mut T, _count: usize);
635-
648+
pub unsafe fn copy<T>(src: *const T, dst: *mut T, count: usize);
636649
#[rustc_intrinsic]
637-
pub unsafe fn transmute<T, U>(_e: T) -> U;
638-
650+
pub unsafe fn transmute<T, U>(e: T) -> U;
639651
#[rustc_intrinsic]
640-
pub unsafe fn ctlz_nonzero<T>(_x: T) -> u32;
641-
652+
pub unsafe fn ctlz_nonzero<T>(x: T) -> u32;
642653
#[rustc_intrinsic]
643654
pub fn needs_drop<T: ?::Sized>() -> bool;
644-
645655
#[rustc_intrinsic]
646-
pub fn bitreverse<T>(_x: T) -> T;
647-
656+
pub fn bitreverse<T>(x: T) -> T;
648657
#[rustc_intrinsic]
649-
pub fn bswap<T>(_x: T) -> T;
650-
658+
pub fn bswap<T>(x: T) -> T;
651659
#[rustc_intrinsic]
652-
pub unsafe fn write_bytes<T>(_dst: *mut T, _val: u8, _count: usize);
653-
660+
pub unsafe fn write_bytes<T>(dst: *mut T, val: u8, count: usize);
654661
#[rustc_intrinsic]
655662
pub unsafe fn unreachable() -> !;
656663
}
@@ -694,7 +701,7 @@ impl<T> Index<usize> for [T] {
694701
}
695702
}
696703

697-
extern {
704+
extern "C" {
698705
type VaListImpl;
699706
}
700707

Diff for: example/mini_core_hello_world.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Adapted from https://github.com/sunfishcode/mir2cranelift/blob/master/rust-examples/nocore-hello-world.rs
22

33
#![feature(
4-
no_core, unboxed_closures, start, lang_items, never_type, linkage,
4+
no_core, unboxed_closures, lang_items, never_type, linkage,
55
extern_types, thread_local
66
)]
77
#![no_core]
@@ -258,13 +258,13 @@ fn main() {
258258

259259
assert_eq!(((|()| 42u8) as fn(()) -> u8)(()), 42);
260260

261-
extern {
261+
extern "C" {
262262
#[linkage = "weak"]
263263
static ABC: *const u8;
264264
}
265265

266266
{
267-
extern {
267+
extern "C" {
268268
#[linkage = "weak"]
269269
static ABC: *const u8;
270270
}

Diff for: example/mod_bench.rs

-36
This file was deleted.

Diff for: example/std_example.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use std::arch::x86_64::*;
77
use std::io::Write;
88
use std::ops::Coroutine;
99

10-
extern {
10+
extern "C" {
1111
pub fn printf(format: *const i8, ...) -> i32;
1212
}
1313

Diff for: libgccjit.version

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
d6f5a708104a98199ac0f01a3b6b279a0f7c66d3
1+
0ea98a1365b81f7488073512c850e8ee951a4afd

Diff for: patches/0022-core-Disable-not-compiling-tests.patch

-44
This file was deleted.

Diff for: patches/0028-core-Disable-long-running-tests.patch

+13-13
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,32 @@
1-
From eb703e627e7a84f1cd8d0d87f0f69da1f0acf765 Mon Sep 17 00:00:00 2001
2-
From: bjorn3 <[email protected].com>
3-
Date: Fri, 3 Dec 2021 12:16:30 +0100
1+
From ec2d0dc77fb484d926b45bb626b0db6a4bb0ab5c Mon Sep 17 00:00:00 2001
2+
From: None <none@example.com>
3+
Date: Thu, 27 Mar 2025 09:20:41 -0400
44
Subject: [PATCH] Disable long running tests
55

66
---
7-
library/core/tests/slice.rs | 2 ++
7+
library/coretests/tests/slice.rs | 2 ++
88
1 file changed, 2 insertions(+)
99

10-
diff --git a/library/core/tests/slice.rs b/library/core/tests/slice.rs
11-
index 8402833..84592e0 100644
12-
--- a/library/core/tests/slice.rs
13-
+++ b/library/core/tests/slice.rs
14-
@@ -2462,6 +2462,7 @@ take_tests! {
10+
diff --git a/library/coretests/tests/slice.rs b/library/coretests/tests/slice.rs
11+
index d17e681..fba5cd6 100644
12+
--- a/library/coretests/tests/slice.rs
13+
+++ b/library/coretests/tests/slice.rs
14+
@@ -2486,6 +2486,7 @@ split_off_tests! {
1515
#[cfg(not(miri))] // unused in Miri
1616
const EMPTY_MAX: &'static [()] = &[(); usize::MAX];
1717

1818
+/*
1919
// can't be a constant due to const mutability rules
2020
#[cfg(not(miri))] // unused in Miri
2121
macro_rules! empty_max_mut {
22-
@@ -2485,6 +2486,7 @@ take_tests! {
23-
(take_mut_oob_max_range_to_inclusive, (..=usize::MAX), None, empty_max_mut!()),
24-
(take_mut_in_bounds_max_range_from, (usize::MAX..), Some(&mut [] as _), empty_max_mut!()),
22+
@@ -2509,6 +2510,7 @@ split_off_tests! {
23+
(split_off_mut_oob_max_range_to_inclusive, (..=usize::MAX), None, empty_max_mut!()),
24+
(split_off_mut_in_bounds_max_range_from, (usize::MAX..), Some(&mut [] as _), empty_max_mut!()),
2525
}
2626
+*/
2727

2828
#[test]
2929
fn test_slice_from_ptr_range() {
3030
--
31-
2.26.2.7.g19db9cfb68
31+
2.49.0
3232

Original file line numberDiff line numberDiff line change
@@ -1,23 +1,25 @@
1-
From 966beefe08be6045bfcca26079b76a7a80413080 Mon Sep 17 00:00:00 2001
1+
From b2911e732d1bf0e28872495c4c47af1dad3c7911 Mon Sep 17 00:00:00 2001
22
From: None <[email protected]>
3-
Date: Thu, 28 Sep 2023 17:37:38 -0400
3+
Date: Thu, 27 Mar 2025 14:30:10 -0400
44
Subject: [PATCH] Disable libstd and libtest dylib
55

66
---
7-
library/std/Cargo.toml | 2 +-
8-
library/test/Cargo.toml | 2 +-
9-
2 files changed, 2 insertions(+), 2 deletions(-)
7+
library/std/Cargo.toml | 2 +-
8+
1 file changed, 1 insertion(+), 1 deletion(-)
109

1110
diff --git a/library/std/Cargo.toml b/library/std/Cargo.toml
12-
index 5b21355..cb0c49b 100644
11+
index 176da60..c183cdb 100644
1312
--- a/library/std/Cargo.toml
1413
+++ b/library/std/Cargo.toml
15-
@@ -9,7 +9,7 @@ description = "The Rust Standard Library"
16-
edition = "2021"
14+
@@ -10,7 +10,7 @@ edition = "2024"
15+
autobenches = false
1716

1817
[lib]
1918
-crate-type = ["dylib", "rlib"]
2019
+crate-type = ["rlib"]
2120

2221
[dependencies]
2322
alloc = { path = "../alloc", public = true }
23+
--
24+
2.49.0
25+

0 commit comments

Comments
 (0)