Rollup merge of #130875 - folkertdev:naked-asm-bootstrap, r=tgross35

update `compiler-builtins` to 0.1.126

this requires the addition of a bootstrap variant of the new `naked_asm!` macro

r? `@tgross35`

extracted from https://github.com/rust-lang/rust/pull/128651
This commit is contained in:
Jubilee 2024-09-26 22:20:55 -07:00 committed by GitHub
commit 1e882537d4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 38 additions and 4 deletions

View File

@ -58,9 +58,9 @@ dependencies = [
[[package]] [[package]]
name = "compiler_builtins" name = "compiler_builtins"
version = "0.1.125" version = "0.1.126"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bd02a01d7bc069bed818e956600fe437ee222dd1d6ad92bfb9db87b43b71fd87" checksum = "758019257ad46e191b587d8f711022a6ac1d1fb6745d75e1d76c587fdcbca770"
dependencies = [ dependencies = [
"cc", "cc",
"rustc-std-workspace-core", "rustc-std-workspace-core",

View File

@ -10,7 +10,7 @@ edition = "2021"
[dependencies] [dependencies]
core = { path = "../core" } core = { path = "../core" }
compiler_builtins = { version = "0.1.125", features = ['rustc-dep-of-std'] } compiler_builtins = { version = "0.1.126", features = ['rustc-dep-of-std'] }
[dev-dependencies] [dev-dependencies]
rand = { version = "0.8.5", default-features = false, features = ["alloc"] } rand = { version = "0.8.5", default-features = false, features = ["alloc"] }

View File

@ -3,6 +3,9 @@
#[allow(unused_imports)] #[allow(unused_imports)]
#[stable(feature = "simd_arch", since = "1.27.0")] #[stable(feature = "simd_arch", since = "1.27.0")]
pub use crate::core_arch::arch::*; pub use crate::core_arch::arch::*;
#[unstable(feature = "naked_functions", issue = "90957")]
#[cfg(bootstrap)]
pub use crate::naked_asm;
/// Inline assembly. /// Inline assembly.
/// ///
@ -17,6 +20,37 @@ pub macro asm("assembly template", $(operands,)* $(options($(option),*))?) {
/* compiler built-in */ /* compiler built-in */
} }
/// Inline assembly used in combination with `#[naked]` functions.
///
/// Refer to [Rust By Example] for a usage guide and the [reference] for
/// detailed information about the syntax and available options.
///
/// [Rust By Example]: https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html
/// [reference]: https://doc.rust-lang.org/nightly/reference/inline-assembly.html
#[unstable(feature = "naked_functions", issue = "90957")]
#[macro_export]
#[cfg(bootstrap)]
macro_rules! naked_asm {
([$last:expr], [$($pushed:expr),*]) => {
#[cfg(any(target_arch = "x86_64", target_arch = "x86"))]
{
core::arch::asm!($($pushed),*, options(att_syntax, noreturn))
}
#[cfg(not(any(target_arch = "x86_64", target_arch = "x86")))]
{
core::arch::asm!($($pushed),* , $last, options(noreturn))
}
};
([$first:expr $(, $rest:expr)*], [$($pushed:expr),*]) => {
naked_asm!([$($rest),*], [$($pushed,)* $first]);
};
($($expr:expr),* $(,)?) => {
naked_asm!([$($expr),*], []);
};
}
/// Inline assembly used in combination with `#[naked]` functions. /// Inline assembly used in combination with `#[naked]` functions.
/// ///
/// Refer to [Rust By Example] for a usage guide and the [reference] for /// Refer to [Rust By Example] for a usage guide and the [reference] for

View File

@ -17,7 +17,7 @@ cfg-if = { version = "1.0", features = ['rustc-dep-of-std'] }
panic_unwind = { path = "../panic_unwind", optional = true } panic_unwind = { path = "../panic_unwind", optional = true }
panic_abort = { path = "../panic_abort" } panic_abort = { path = "../panic_abort" }
core = { path = "../core", public = true } core = { path = "../core", public = true }
compiler_builtins = { version = "0.1.125" } compiler_builtins = { version = "0.1.126" }
profiler_builtins = { path = "../profiler_builtins", optional = true } profiler_builtins = { path = "../profiler_builtins", optional = true }
unwind = { path = "../unwind" } unwind = { path = "../unwind" }
hashbrown = { version = "0.14", default-features = false, features = [ hashbrown = { version = "0.14", default-features = false, features = [