Skip to content

Commit 15d23bd

Browse files
authored
Merge pull request #723 from rust-lang/sync_from_rust_2025_06_28
Sync from rust 2025/06/28
2 parents b7091ec + 4347a92 commit 15d23bd

22 files changed

+222
-450
lines changed

build_system/build_sysroot/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ resolver = "2"
66

77
[dependencies]
88
core = { path = "./sysroot_src/library/core" }
9-
compiler_builtins = "0.1"
9+
compiler_builtins = { path = "./sysroot_src/library/compiler-builtins/compiler-builtins" }
1010
alloc = { path = "./sysroot_src/library/alloc" }
1111
std = { path = "./sysroot_src/library/std", features = ["panic_unwind", "backtrace"] }
1212
test = { path = "./sysroot_src/library/test" }
@@ -16,6 +16,7 @@ proc_macro = { path = "./sysroot_src/library/proc_macro" }
1616
rustc-std-workspace-core = { path = "./sysroot_src/library/rustc-std-workspace-core" }
1717
rustc-std-workspace-alloc = { path = "./sysroot_src/library/rustc-std-workspace-alloc" }
1818
rustc-std-workspace-std = { path = "./sysroot_src/library/rustc-std-workspace-std" }
19+
compiler_builtins = { path = "./sysroot_src/library/compiler-builtins/compiler-builtins" }
1920

2021
# For compiler-builtins we always use a high number of codegen units.
2122
# The goal here is to place every single intrinsic into its own object

build_system/src/test.rs

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ use crate::build;
99
use crate::config::{Channel, ConfigInfo};
1010
use crate::utils::{
1111
create_dir, get_sysroot_dir, get_toolchain, git_clone, git_clone_root_dir, remove_file,
12-
run_command, run_command_with_env, run_command_with_output, run_command_with_output_and_env,
13-
rustc_version_info, split_args, walk_dir,
12+
run_command, run_command_with_env, run_command_with_output_and_env, rustc_version_info,
13+
split_args, walk_dir,
1414
};
1515

1616
type Env = HashMap<String, String>;
@@ -485,30 +485,6 @@ fn setup_rustc(env: &mut Env, args: &TestArg) -> Result<PathBuf, String> {
485485
run_command_with_output_and_env(&[&"git", &"checkout"], rust_dir, Some(env))?;
486486
}
487487

488-
let mut patches = Vec::new();
489-
walk_dir(
490-
"patches/tests",
491-
&mut |_| Ok(()),
492-
&mut |file_path: &Path| {
493-
patches.push(file_path.to_path_buf());
494-
Ok(())
495-
},
496-
false,
497-
)?;
498-
patches.sort();
499-
// TODO: remove duplication with prepare.rs by creating a apply_patch function in the utils
500-
// module.
501-
for file_path in patches {
502-
println!("[GIT] apply `{}`", file_path.display());
503-
let path = Path::new("../..").join(file_path);
504-
run_command_with_output(&[&"git", &"apply", &path], rust_dir)?;
505-
run_command_with_output(&[&"git", &"add", &"-A"], rust_dir)?;
506-
run_command_with_output(
507-
&[&"git", &"commit", &"--no-gpg-sign", &"-m", &format!("Patch {}", path.display())],
508-
rust_dir,
509-
)?;
510-
}
511-
512488
let cargo = String::from_utf8(
513489
run_command_with_env(&[&"rustup", &"which", &"cargo"], rust_dir, Some(env))?.stdout,
514490
)

example/alloc_system.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
// add fast paths for low alignment values.
99
#[cfg(any(target_arch = "x86",
1010
target_arch = "arm",
11+
target_arch = "loongarch32",
1112
target_arch = "m68k",
1213
target_arch = "mips",
1314
target_arch = "mips32r6",

example/arbitrary_self_types_pointers_and_wrappers.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,6 @@ impl<T: DispatchFromDyn<U>, U> DispatchFromDyn<Wrapper<U>> for Wrapper<T> {}
3737

3838

3939
trait Trait {
40-
// This method isn't object-safe yet. Unsized by-value `self` is object-safe (but not callable
41-
// without unsized_locals), but wrappers around `Self` currently are not.
42-
// FIXME (mikeyhew) uncomment this when unsized rvalues object-safety is implemented
43-
// fn wrapper(self: Wrapper<Self>) -> i32;
4440
fn ptr_wrapper(self: Ptr<Wrapper<Self>>) -> i32;
4541
fn wrapper_ptr(self: Wrapper<Ptr<Self>>) -> i32;
4642
fn wrapper_ptr_wrapper(self: Wrapper<Ptr<Wrapper<Self>>>) -> i32;

example/mini_core.rs

Lines changed: 38 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,14 @@ unsafe extern "C" fn _Unwind_Resume() {
1919
intrinsics::unreachable();
2020
}
2121

22+
#[lang = "pointee_sized"]
23+
pub trait PointeeSized {}
24+
25+
#[lang = "meta_sized"]
26+
pub trait MetaSized: PointeeSized {}
27+
2228
#[lang = "sized"]
23-
pub trait Sized {}
29+
pub trait Sized: MetaSized {}
2430

2531
#[lang = "destruct"]
2632
pub trait Destruct {}
@@ -29,35 +35,35 @@ pub trait Destruct {}
2935
pub trait Tuple {}
3036

3137
#[lang = "unsize"]
32-
pub trait Unsize<T: ?Sized> {}
38+
pub trait Unsize<T: PointeeSized>: PointeeSized {}
3339

3440
#[lang = "coerce_unsized"]
3541
pub trait CoerceUnsized<T> {}
3642

37-
impl<'a, 'b: 'a, T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<&'a U> for &'b T {}
38-
impl<'a, T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<&'a mut U> for &'a mut T {}
39-
impl<T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<*const U> for *const T {}
40-
impl<T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<*mut U> for *mut T {}
43+
impl<'a, 'b: 'a, T: PointeeSized + Unsize<U>, U: PointeeSized> CoerceUnsized<&'a U> for &'b T {}
44+
impl<'a, T: PointeeSized + Unsize<U>, U: PointeeSized> CoerceUnsized<&'a mut U> for &'a mut T {}
45+
impl<T: PointeeSized + Unsize<U>, U: PointeeSized> CoerceUnsized<*const U> for *const T {}
46+
impl<T: PointeeSized + Unsize<U>, U: PointeeSized> CoerceUnsized<*mut U> for *mut T {}
4147

4248
#[lang = "dispatch_from_dyn"]
4349
pub trait DispatchFromDyn<T> {}
4450

4551
// &T -> &U
46-
impl<'a, T: ?Sized + Unsize<U>, U: ?Sized> DispatchFromDyn<&'a U> for &'a T {}
52+
impl<'a, T: PointeeSized + Unsize<U>, U: PointeeSized> DispatchFromDyn<&'a U> for &'a T {}
4753
// &mut T -> &mut U
48-
impl<'a, T: ?Sized + Unsize<U>, U: ?Sized> DispatchFromDyn<&'a mut U> for &'a mut T {}
54+
impl<'a, T: PointeeSized + Unsize<U>, U: PointeeSized> DispatchFromDyn<&'a mut U> for &'a mut T {}
4955
// *const T -> *const U
50-
impl<T: ?Sized + Unsize<U>, U: ?Sized> DispatchFromDyn<*const U> for *const T {}
56+
impl<T: PointeeSized + Unsize<U>, U: PointeeSized> DispatchFromDyn<*const U> for *const T {}
5157
// *mut T -> *mut U
52-
impl<T: ?Sized + Unsize<U>, U: ?Sized> DispatchFromDyn<*mut U> for *mut T {}
53-
impl<T: ?Sized + Unsize<U>, U: ?Sized> DispatchFromDyn<Box<U, ()>> for Box<T, ()> {}
58+
impl<T: PointeeSized + Unsize<U>, U: PointeeSized> DispatchFromDyn<*mut U> for *mut T {}
59+
impl<T: MetaSized + Unsize<U>, U: MetaSized> DispatchFromDyn<Box<U, ()>> for Box<T, ()> {}
5460

5561
#[lang = "legacy_receiver"]
5662
pub trait LegacyReceiver {}
5763

58-
impl<T: ?Sized> LegacyReceiver for &T {}
59-
impl<T: ?Sized> LegacyReceiver for &mut T {}
60-
impl<T: ?Sized, A: Allocator> LegacyReceiver for Box<T, A> {}
64+
impl<T: PointeeSized> LegacyReceiver for &T {}
65+
impl<T: PointeeSized> LegacyReceiver for &mut T {}
66+
impl<T: MetaSized> LegacyReceiver for Box<T> {}
6167

6268
#[lang = "receiver"]
6369
trait Receiver {}
@@ -84,9 +90,9 @@ impl Copy for i128 {}
8490
impl Copy for f32 {}
8591
impl Copy for f64 {}
8692
impl Copy for char {}
87-
impl<'a, T: ?Sized> Copy for &'a T {}
88-
impl<T: ?Sized> Copy for *const T {}
89-
impl<T: ?Sized> Copy for *mut T {}
93+
impl<'a, T: PointeeSized> Copy for &'a T {}
94+
impl<T: PointeeSized> Copy for *const T {}
95+
impl<T: PointeeSized> Copy for *mut T {}
9096

9197
#[lang = "sync"]
9298
pub unsafe trait Sync {}
@@ -102,17 +108,17 @@ unsafe impl Sync for i16 {}
102108
unsafe impl Sync for i32 {}
103109
unsafe impl Sync for isize {}
104110
unsafe impl Sync for char {}
105-
unsafe impl<'a, T: ?Sized> Sync for &'a T {}
111+
unsafe impl<'a, T: PointeeSized> Sync for &'a T {}
106112
unsafe impl Sync for [u8; 16] {}
107113

108114
#[lang = "freeze"]
109115
unsafe auto trait Freeze {}
110116

111-
unsafe impl<T: ?Sized> Freeze for PhantomData<T> {}
112-
unsafe impl<T: ?Sized> Freeze for *const T {}
113-
unsafe impl<T: ?Sized> Freeze for *mut T {}
114-
unsafe impl<T: ?Sized> Freeze for &T {}
115-
unsafe impl<T: ?Sized> Freeze for &mut T {}
117+
unsafe impl<T: PointeeSized> Freeze for PhantomData<T> {}
118+
unsafe impl<T: PointeeSized> Freeze for *const T {}
119+
unsafe impl<T: PointeeSized> Freeze for *mut T {}
120+
unsafe impl<T: PointeeSized> Freeze for &T {}
121+
unsafe impl<T: PointeeSized> Freeze for &mut T {}
116122

117123
#[lang = "structural_peq"]
118124
pub trait StructuralPartialEq {}
@@ -456,7 +462,7 @@ pub enum Option<T> {
456462
pub use Option::*;
457463

458464
#[lang = "phantom_data"]
459-
pub struct PhantomData<T: ?Sized>;
465+
pub struct PhantomData<T: PointeeSized>;
460466

461467
#[lang = "fn_once"]
462468
#[rustc_paren_sugar]
@@ -576,18 +582,18 @@ impl Allocator for Global {}
576582
#[repr(transparent)]
577583
#[rustc_layout_scalar_valid_range_start(1)]
578584
#[rustc_nonnull_optimization_guaranteed]
579-
pub struct NonNull<T: ?Sized>(pub *const T);
585+
pub struct NonNull<T: PointeeSized>(pub *const T);
580586

581-
impl<T: ?Sized, U: ?Sized> CoerceUnsized<NonNull<U>> for NonNull<T> where T: Unsize<U> {}
582-
impl<T: ?Sized, U: ?Sized> DispatchFromDyn<NonNull<U>> for NonNull<T> where T: Unsize<U> {}
587+
impl<T: PointeeSized, U: PointeeSized> CoerceUnsized<NonNull<U>> for NonNull<T> where T: Unsize<U> {}
588+
impl<T: PointeeSized, U: PointeeSized> DispatchFromDyn<NonNull<U>> for NonNull<T> where T: Unsize<U> {}
583589

584-
pub struct Unique<T: ?Sized> {
590+
pub struct Unique<T: PointeeSized> {
585591
pub pointer: NonNull<T>,
586592
pub _marker: PhantomData<T>,
587593
}
588594

589-
impl<T: ?Sized, U: ?Sized> CoerceUnsized<Unique<U>> for Unique<T> where T: Unsize<U> {}
590-
impl<T: ?Sized, U: ?Sized> DispatchFromDyn<Unique<U>> for Unique<T> where T: Unsize<U> {}
595+
impl<T: PointeeSized, U: PointeeSized> CoerceUnsized<Unique<U>> for Unique<T> where T: Unsize<U> {}
596+
impl<T: PointeeSized, U: PointeeSized> DispatchFromDyn<Unique<U>> for Unique<T> where T: Unsize<U> {}
591597

592598
#[lang = "owned_box"]
593599
pub struct Box<T: ?Sized, A: Allocator = Global>(Unique<T>, A);
@@ -655,9 +661,9 @@ pub mod intrinsics {
655661
#[rustc_intrinsic]
656662
pub unsafe fn size_of_val<T: ?::Sized>(val: *const T) -> usize;
657663
#[rustc_intrinsic]
658-
pub fn min_align_of<T>() -> usize;
664+
pub fn align_of<T>() -> usize;
659665
#[rustc_intrinsic]
660-
pub unsafe fn min_align_of_val<T: ?::Sized>(val: *const T) -> usize;
666+
pub unsafe fn align_of_val<T: ?::Sized>(val: *const T) -> usize;
661667
#[rustc_intrinsic]
662668
pub unsafe fn copy<T>(src: *const T, dst: *mut T, count: usize);
663669
#[rustc_intrinsic]

example/mini_core_hello_world.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ fn main() {
153153
let slice = &[0, 1] as &[i32];
154154
let slice_ptr = slice as *const [i32] as *const i32;
155155

156-
let align = intrinsics::min_align_of::<*const i32>();
156+
let align = intrinsics::align_of::<*const i32>();
157157
assert_eq!(slice_ptr as usize % align, 0);
158158

159159
//return;
@@ -194,8 +194,8 @@ fn main() {
194194
assert_eq!(intrinsics::size_of_val(a) as u8, 8);
195195
assert_eq!(intrinsics::size_of_val(&0u32) as u8, 4);
196196

197-
assert_eq!(intrinsics::min_align_of::<u16>() as u8, 2);
198-
assert_eq!(intrinsics::min_align_of_val(&a) as u8, intrinsics::min_align_of::<&str>() as u8);
197+
assert_eq!(intrinsics::align_of::<u16>() as u8, 2);
198+
assert_eq!(intrinsics::align_of_val(&a) as u8, intrinsics::align_of::<&str>() as u8);
199199

200200
assert!(!intrinsics::needs_drop::<u8>());
201201
assert!(!intrinsics::needs_drop::<[u8]>());

messages.ftl

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,3 @@
1-
codegen_gcc_unknown_ctarget_feature_prefix =
2-
unknown feature specified for `-Ctarget-feature`: `{$feature}`
3-
.note = features must begin with a `+` to enable or `-` to disable it
4-
5-
codegen_gcc_invalid_minimum_alignment =
6-
invalid minimum global alignment: {$err}
7-
8-
codegen_gcc_forbidden_ctarget_feature =
9-
target feature `{$feature}` cannot be toggled with `-Ctarget-feature`: {$reason}
10-
111
codegen_gcc_unwinding_inline_asm =
122
GCC backend does not support unwinding from inline asm
133
@@ -22,19 +12,3 @@ codegen_gcc_lto_disallowed = lto can only be run for executables, cdylibs and st
2212
codegen_gcc_lto_dylib = lto cannot be used for `dylib` crate type without `-Zdylib-lto`
2313
2414
codegen_gcc_lto_bitcode_from_rlib = failed to get bitcode from object file for LTO ({$gcc_err})
25-
26-
codegen_gcc_unknown_ctarget_feature =
27-
unknown and unstable feature specified for `-Ctarget-feature`: `{$feature}`
28-
.note = it is still passed through to the codegen backend, but use of this feature might be unsound and the behavior of this feature can change in the future
29-
.possible_feature = you might have meant: `{$rust_feature}`
30-
.consider_filing_feature_request = consider filing a feature request
31-
32-
codegen_gcc_unstable_ctarget_feature =
33-
unstable feature specified for `-Ctarget-feature`: `{$feature}`
34-
.note = this feature is not stably supported; its behavior can change in the future
35-
36-
codegen_gcc_missing_features =
37-
add the missing features in a `target_feature` attribute
38-
39-
codegen_gcc_target_feature_disable_or_enable =
40-
the target features {$features} must all be either enabled or disabled together

patches/tests/0001-Workaround-to-make-a-run-make-test-pass.patch

Lines changed: 0 additions & 25 deletions
This file was deleted.

rust-toolchain

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[toolchain]
2-
channel = "nightly-2025-06-02"
2+
channel = "nightly-2025-06-28"
33
components = ["rust-src", "rustc-dev", "llvm-tools-preview"]

0 commit comments

Comments
 (0)