Skip to content

Sync from rust 2025/06/28 #723

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 48 commits into from
Jun 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
6c982df
Remove get_dbg_loc from DebugInfoBuilderMethods
bjorn3 Jun 3, 2025
9eced6c
Remove type_test from IntrinsicCallBuilderMethods
bjorn3 Jun 3, 2025
46575f1
Only borrow EncodedMetadata in codegen_crate
bjorn3 May 30, 2025
7ed4c58
Move metadata object generation for dylibs to the linker code
bjorn3 May 30, 2025
0f7ec70
cg_gcc: convert to CanonAbi
workingjubilee May 21, 2025
906fc5c
Rollup merge of #141569 - workingjubilee:canonicalize-abi, r=bjorn3
matthiaskrgr Jun 3, 2025
620a4f3
Add new Tier-3 targets: `loongarch32-unknown-none*`
heiher Jan 9, 2025
3f2666c
store `target.min_global_align` as an `Align`
folkertdev Jun 7, 2025
10129e4
Use the in-tree `compiler-builtins`
tgross35 Jun 4, 2025
5f20249
Remove all unused feature gates from the compiler
bjorn3 Jun 8, 2025
732253f
Rollup merge of #142179 - folkertdev:min-global-align-parse, r=workin…
workingjubilee Jun 9, 2025
9f85857
Rollup merge of #142194 - bjorn3:less_unstable_features, r=jieyouxu
workingjubilee Jun 9, 2025
f485c26
-Zretpoline and -Zretpoline-external-thunk flags (target modifiers) t…
azhogin Jan 15, 2025
98e21c8
Rollup merge of #141993 - tgross35:use-in-tree-builtins, r=bjorn3
tgross35 Jun 9, 2025
fa425db
Simplify implementation of Rust intrinsics by using type parameters i…
sayantn May 30, 2025
f5c6288
intrinsics: rename min_align_of to align_of
RalfJung Jun 12, 2025
65042d6
add `extern "custom"` functions
folkertdev May 7, 2025
1ff33b5
Unimplement unsized_locals
mejrs Jun 12, 2025
ad90ea8
Rollup merge of #135927 - azhogin:azhogin/retpoline, r=davidtwco
matthiaskrgr Jun 13, 2025
3766fb2
Rollup merge of #140770 - folkertdev:custom-abi, r=tgross35
matthiaskrgr Jun 13, 2025
baaf8da
Auto merge of #142443 - matthiaskrgr:rollup-l1l6d0v, r=matthiaskrgr
bors Jun 13, 2025
4ffcf80
Rollup merge of #141811 - mejrs:bye_locals, r=compiler-errors
matthiaskrgr Jun 14, 2025
3c96f6e
Remove all support for wasm's legacy ABI
bjorn3 Dec 6, 2024
5b660c5
Auto merge of #142259 - sayantn:simplify-intrinsics, r=workingjubilee
bors Jun 14, 2025
29e0e4f
Rollup merge of #133952 - bjorn3:remove_wasm_legacy_abi, r=alexcrichton
fmease Jun 15, 2025
8f47346
Rollup merge of #141769 - bjorn3:codegen_metadata_module_rework, r=wo…
fmease Jun 15, 2025
308ca33
Fix RISC-V C function ABI when passing/returning structs containing f…
beetrees Apr 3, 2025
5615d05
Change __rust_no_alloc_shim_is_unstable to be a function
dpaoliello May 15, 2025
e9d795d
cranelift/gcc: `{Meta,Pointee,}Sized` in minicore
davidtwco Mar 5, 2025
2811b34
Auto merge of #137944 - davidtwco:sized-hierarchy, r=oli-obk
bors Jun 17, 2025
265f4a7
Auto merge of #141061 - dpaoliello:shimasfn, r=bjorn3
bors Jun 18, 2025
efb7997
Merge commit 'fda0bb9588912a3e0606e880ca9f6e913cf8a5a4' into subtree-…
GuillaumeGomez Jun 18, 2025
6bbf8b1
GCC backend: Remove `add_eval` if no function is created
GuillaumeGomez Jun 18, 2025
25eb2ee
move cfg(target_feature) computation into shared place
RalfJung May 10, 2025
63c9292
move -Ctarget-feature handling into shared code
RalfJung May 23, 2025
3a0881c
cg_gcc: properly populate cfg(target_features) with -Ctarget-features
RalfJung May 11, 2025
1aabebc
various minor target feature cleanups
RalfJung Jun 14, 2025
f8db66b
Remove dead instructions in terminate blocks
Mark-Simulacrum Jun 22, 2025
7014ca4
rustc_codegen_gcc: Fix clippy::manual_is_multiple_of
flip1995 Jun 27, 2025
a836612
Merge branch 'master' into sync_from_rust_2025_06_28
antoyo Jun 28, 2025
a80f3c4
Fix clippy warnings
antoyo Jun 28, 2025
38fa4a4
Fix sysroot Cargo.toml for compiler-builtins
antoyo Jun 28, 2025
e3bb127
Add support for copysignf16 intrinsic
antoyo Jun 28, 2025
fe8b5e6
Remove now useless patch for run-make test
antoyo Jun 28, 2025
99780df
Fix intrinsic copysignf128
antoyo Jun 29, 2025
769fb75
Fix exactudiv and exactsdiv for gcc without 128-bit integers
antoyo Jun 29, 2025
67d8469
Add support for a few missing LLVM intrinsics
antoyo Jun 29, 2025
4347a92
Fix handling of __builtin_ia32_rdtscp
antoyo Jun 29, 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
3 changes: 2 additions & 1 deletion build_system/build_sysroot/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ resolver = "2"

[dependencies]
core = { path = "./sysroot_src/library/core" }
compiler_builtins = "0.1"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I think instead of removing this line it probably should have been changed to

compiler_builtins = { path = "./sysroot_src/library/compiler-builtins/compiler-builtins" }

Not entirely sure how this works but I'm guessing it needs to be brought into this graph

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems to fix this issue. Thanks!

@bjorn3: I tried using the Cargo.toml from the Rust repo directly, but I get the same error. Is it possible it would need this line added there as well?

Copy link
Contributor

@tgross35 tgross35 Jun 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the library workspace, compiler-builtins is now getting into the graph via rustc-std-workspace-core https://github.com/rust-lang/rust/blob/11ad40bb839ca16f74784b4ab72596ad85587298/library/rustc-std-workspace-core/Cargo.toml. Assuming rustc-std-workspace-core is in the graph, I'm not sure why that branch would be getting the error - probably need to look verbose logs or cargo tree to figure out what's going on.

(tbh I'm not sure why it fails without the change here either)

compiler_builtins = { path = "./sysroot_src/library/compiler-builtins/compiler-builtins" }
alloc = { path = "./sysroot_src/library/alloc" }
std = { path = "./sysroot_src/library/std", features = ["panic_unwind", "backtrace"] }
test = { path = "./sysroot_src/library/test" }
Expand All @@ -16,6 +16,7 @@ proc_macro = { path = "./sysroot_src/library/proc_macro" }
rustc-std-workspace-core = { path = "./sysroot_src/library/rustc-std-workspace-core" }
rustc-std-workspace-alloc = { path = "./sysroot_src/library/rustc-std-workspace-alloc" }
rustc-std-workspace-std = { path = "./sysroot_src/library/rustc-std-workspace-std" }
compiler_builtins = { path = "./sysroot_src/library/compiler-builtins/compiler-builtins" }

# For compiler-builtins we always use a high number of codegen units.
# The goal here is to place every single intrinsic into its own object
Expand Down
28 changes: 2 additions & 26 deletions build_system/src/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ use crate::build;
use crate::config::{Channel, ConfigInfo};
use crate::utils::{
create_dir, get_sysroot_dir, get_toolchain, git_clone, git_clone_root_dir, remove_file,
run_command, run_command_with_env, run_command_with_output, run_command_with_output_and_env,
rustc_version_info, split_args, walk_dir,
run_command, run_command_with_env, run_command_with_output_and_env, rustc_version_info,
split_args, walk_dir,
};

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

let mut patches = Vec::new();
walk_dir(
"patches/tests",
&mut |_| Ok(()),
&mut |file_path: &Path| {
patches.push(file_path.to_path_buf());
Ok(())
},
false,
)?;
patches.sort();
// TODO: remove duplication with prepare.rs by creating a apply_patch function in the utils
// module.
for file_path in patches {
println!("[GIT] apply `{}`", file_path.display());
let path = Path::new("../..").join(file_path);
run_command_with_output(&[&"git", &"apply", &path], rust_dir)?;
run_command_with_output(&[&"git", &"add", &"-A"], rust_dir)?;
run_command_with_output(
&[&"git", &"commit", &"--no-gpg-sign", &"-m", &format!("Patch {}", path.display())],
rust_dir,
)?;
}

let cargo = String::from_utf8(
run_command_with_env(&[&"rustup", &"which", &"cargo"], rust_dir, Some(env))?.stdout,
)
Expand Down
1 change: 1 addition & 0 deletions example/alloc_system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
// add fast paths for low alignment values.
#[cfg(any(target_arch = "x86",
target_arch = "arm",
target_arch = "loongarch32",
target_arch = "m68k",
target_arch = "mips",
target_arch = "mips32r6",
Expand Down
4 changes: 0 additions & 4 deletions example/arbitrary_self_types_pointers_and_wrappers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,6 @@ impl<T: DispatchFromDyn<U>, U> DispatchFromDyn<Wrapper<U>> for Wrapper<T> {}


trait Trait {
// This method isn't object-safe yet. Unsized by-value `self` is object-safe (but not callable
// without unsized_locals), but wrappers around `Self` currently are not.
// FIXME (mikeyhew) uncomment this when unsized rvalues object-safety is implemented
// fn wrapper(self: Wrapper<Self>) -> i32;
fn ptr_wrapper(self: Ptr<Wrapper<Self>>) -> i32;
fn wrapper_ptr(self: Wrapper<Ptr<Self>>) -> i32;
fn wrapper_ptr_wrapper(self: Wrapper<Ptr<Wrapper<Self>>>) -> i32;
Expand Down
70 changes: 38 additions & 32 deletions example/mini_core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,14 @@ unsafe extern "C" fn _Unwind_Resume() {
intrinsics::unreachable();
}

#[lang = "pointee_sized"]
pub trait PointeeSized {}

#[lang = "meta_sized"]
pub trait MetaSized: PointeeSized {}

#[lang = "sized"]
pub trait Sized {}
pub trait Sized: MetaSized {}

#[lang = "destruct"]
pub trait Destruct {}
Expand All @@ -29,35 +35,35 @@ pub trait Destruct {}
pub trait Tuple {}

#[lang = "unsize"]
pub trait Unsize<T: ?Sized> {}
pub trait Unsize<T: PointeeSized>: PointeeSized {}

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

impl<'a, 'b: 'a, T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<&'a U> for &'b T {}
impl<'a, T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<&'a mut U> for &'a mut T {}
impl<T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<*const U> for *const T {}
impl<T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<*mut U> for *mut T {}
impl<'a, 'b: 'a, T: PointeeSized + Unsize<U>, U: PointeeSized> CoerceUnsized<&'a U> for &'b T {}
impl<'a, T: PointeeSized + Unsize<U>, U: PointeeSized> CoerceUnsized<&'a mut U> for &'a mut T {}
impl<T: PointeeSized + Unsize<U>, U: PointeeSized> CoerceUnsized<*const U> for *const T {}
impl<T: PointeeSized + Unsize<U>, U: PointeeSized> CoerceUnsized<*mut U> for *mut T {}

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

// &T -> &U
impl<'a, T: ?Sized + Unsize<U>, U: ?Sized> DispatchFromDyn<&'a U> for &'a T {}
impl<'a, T: PointeeSized + Unsize<U>, U: PointeeSized> DispatchFromDyn<&'a U> for &'a T {}
// &mut T -> &mut U
impl<'a, T: ?Sized + Unsize<U>, U: ?Sized> DispatchFromDyn<&'a mut U> for &'a mut T {}
impl<'a, T: PointeeSized + Unsize<U>, U: PointeeSized> DispatchFromDyn<&'a mut U> for &'a mut T {}
// *const T -> *const U
impl<T: ?Sized + Unsize<U>, U: ?Sized> DispatchFromDyn<*const U> for *const T {}
impl<T: PointeeSized + Unsize<U>, U: PointeeSized> DispatchFromDyn<*const U> for *const T {}
// *mut T -> *mut U
impl<T: ?Sized + Unsize<U>, U: ?Sized> DispatchFromDyn<*mut U> for *mut T {}
impl<T: ?Sized + Unsize<U>, U: ?Sized> DispatchFromDyn<Box<U, ()>> for Box<T, ()> {}
impl<T: PointeeSized + Unsize<U>, U: PointeeSized> DispatchFromDyn<*mut U> for *mut T {}
impl<T: MetaSized + Unsize<U>, U: MetaSized> DispatchFromDyn<Box<U, ()>> for Box<T, ()> {}

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

impl<T: ?Sized> LegacyReceiver for &T {}
impl<T: ?Sized> LegacyReceiver for &mut T {}
impl<T: ?Sized, A: Allocator> LegacyReceiver for Box<T, A> {}
impl<T: PointeeSized> LegacyReceiver for &T {}
impl<T: PointeeSized> LegacyReceiver for &mut T {}
impl<T: MetaSized> LegacyReceiver for Box<T> {}

#[lang = "receiver"]
trait Receiver {}
Expand All @@ -84,9 +90,9 @@ impl Copy for i128 {}
impl Copy for f32 {}
impl Copy for f64 {}
impl Copy for char {}
impl<'a, T: ?Sized> Copy for &'a T {}
impl<T: ?Sized> Copy for *const T {}
impl<T: ?Sized> Copy for *mut T {}
impl<'a, T: PointeeSized> Copy for &'a T {}
impl<T: PointeeSized> Copy for *const T {}
impl<T: PointeeSized> Copy for *mut T {}

#[lang = "sync"]
pub unsafe trait Sync {}
Expand All @@ -102,17 +108,17 @@ unsafe impl Sync for i16 {}
unsafe impl Sync for i32 {}
unsafe impl Sync for isize {}
unsafe impl Sync for char {}
unsafe impl<'a, T: ?Sized> Sync for &'a T {}
unsafe impl<'a, T: PointeeSized> Sync for &'a T {}
unsafe impl Sync for [u8; 16] {}

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

unsafe impl<T: ?Sized> Freeze for PhantomData<T> {}
unsafe impl<T: ?Sized> Freeze for *const T {}
unsafe impl<T: ?Sized> Freeze for *mut T {}
unsafe impl<T: ?Sized> Freeze for &T {}
unsafe impl<T: ?Sized> Freeze for &mut T {}
unsafe impl<T: PointeeSized> Freeze for PhantomData<T> {}
unsafe impl<T: PointeeSized> Freeze for *const T {}
unsafe impl<T: PointeeSized> Freeze for *mut T {}
unsafe impl<T: PointeeSized> Freeze for &T {}
unsafe impl<T: PointeeSized> Freeze for &mut T {}

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

#[lang = "phantom_data"]
pub struct PhantomData<T: ?Sized>;
pub struct PhantomData<T: PointeeSized>;

#[lang = "fn_once"]
#[rustc_paren_sugar]
Expand Down Expand Up @@ -576,18 +582,18 @@ impl Allocator for Global {}
#[repr(transparent)]
#[rustc_layout_scalar_valid_range_start(1)]
#[rustc_nonnull_optimization_guaranteed]
pub struct NonNull<T: ?Sized>(pub *const T);
pub struct NonNull<T: PointeeSized>(pub *const T);

impl<T: ?Sized, U: ?Sized> CoerceUnsized<NonNull<U>> for NonNull<T> where T: Unsize<U> {}
impl<T: ?Sized, U: ?Sized> DispatchFromDyn<NonNull<U>> for NonNull<T> where T: Unsize<U> {}
impl<T: PointeeSized, U: PointeeSized> CoerceUnsized<NonNull<U>> for NonNull<T> where T: Unsize<U> {}
impl<T: PointeeSized, U: PointeeSized> DispatchFromDyn<NonNull<U>> for NonNull<T> where T: Unsize<U> {}

pub struct Unique<T: ?Sized> {
pub struct Unique<T: PointeeSized> {
pub pointer: NonNull<T>,
pub _marker: PhantomData<T>,
}

impl<T: ?Sized, U: ?Sized> CoerceUnsized<Unique<U>> for Unique<T> where T: Unsize<U> {}
impl<T: ?Sized, U: ?Sized> DispatchFromDyn<Unique<U>> for Unique<T> where T: Unsize<U> {}
impl<T: PointeeSized, U: PointeeSized> CoerceUnsized<Unique<U>> for Unique<T> where T: Unsize<U> {}
impl<T: PointeeSized, U: PointeeSized> DispatchFromDyn<Unique<U>> for Unique<T> where T: Unsize<U> {}

#[lang = "owned_box"]
pub struct Box<T: ?Sized, A: Allocator = Global>(Unique<T>, A);
Expand Down Expand Up @@ -655,9 +661,9 @@ pub mod intrinsics {
#[rustc_intrinsic]
pub unsafe fn size_of_val<T: ?::Sized>(val: *const T) -> usize;
#[rustc_intrinsic]
pub fn min_align_of<T>() -> usize;
pub fn align_of<T>() -> usize;
#[rustc_intrinsic]
pub unsafe fn min_align_of_val<T: ?::Sized>(val: *const T) -> usize;
pub unsafe fn align_of_val<T: ?::Sized>(val: *const T) -> usize;
#[rustc_intrinsic]
pub unsafe fn copy<T>(src: *const T, dst: *mut T, count: usize);
#[rustc_intrinsic]
Expand Down
6 changes: 3 additions & 3 deletions example/mini_core_hello_world.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ fn main() {
let slice = &[0, 1] as &[i32];
let slice_ptr = slice as *const [i32] as *const i32;

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

//return;
Expand Down Expand Up @@ -194,8 +194,8 @@ fn main() {
assert_eq!(intrinsics::size_of_val(a) as u8, 8);
assert_eq!(intrinsics::size_of_val(&0u32) as u8, 4);

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

assert!(!intrinsics::needs_drop::<u8>());
assert!(!intrinsics::needs_drop::<[u8]>());
Expand Down
26 changes: 0 additions & 26 deletions messages.ftl
Original file line number Diff line number Diff line change
@@ -1,13 +1,3 @@
codegen_gcc_unknown_ctarget_feature_prefix =
unknown feature specified for `-Ctarget-feature`: `{$feature}`
.note = features must begin with a `+` to enable or `-` to disable it

codegen_gcc_invalid_minimum_alignment =
invalid minimum global alignment: {$err}

codegen_gcc_forbidden_ctarget_feature =
target feature `{$feature}` cannot be toggled with `-Ctarget-feature`: {$reason}

codegen_gcc_unwinding_inline_asm =
GCC backend does not support unwinding from inline asm

Expand All @@ -22,19 +12,3 @@ codegen_gcc_lto_disallowed = lto can only be run for executables, cdylibs and st
codegen_gcc_lto_dylib = lto cannot be used for `dylib` crate type without `-Zdylib-lto`

codegen_gcc_lto_bitcode_from_rlib = failed to get bitcode from object file for LTO ({$gcc_err})

codegen_gcc_unknown_ctarget_feature =
unknown and unstable feature specified for `-Ctarget-feature`: `{$feature}`
.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
.possible_feature = you might have meant: `{$rust_feature}`
.consider_filing_feature_request = consider filing a feature request

codegen_gcc_unstable_ctarget_feature =
unstable feature specified for `-Ctarget-feature`: `{$feature}`
.note = this feature is not stably supported; its behavior can change in the future

codegen_gcc_missing_features =
add the missing features in a `target_feature` attribute

codegen_gcc_target_feature_disable_or_enable =
the target features {$features} must all be either enabled or disabled together
25 changes: 0 additions & 25 deletions patches/tests/0001-Workaround-to-make-a-run-make-test-pass.patch

This file was deleted.

2 changes: 1 addition & 1 deletion rust-toolchain
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[toolchain]
channel = "nightly-2025-06-02"
channel = "nightly-2025-06-28"
components = ["rust-src", "rustc-dev", "llvm-tools-preview"]
Loading