Skip to content

Commit

Permalink
Rollup merge of #87227 - bstrie:asm2arch, r=Amanieu
Browse files Browse the repository at this point in the history
Move asm! and global_asm! to core::arch

Follow-up to rust-lang/stdarch#1183 .

Implements the libs-api team decision from #84019 (comment) .

In order to not break nightly users, this PR also adds the newly-moved items to the prelude. However, a decision will need to be made before stabilization as to whether these items should remain in the prelude. I will file an issue for this separately.

Fixes #84019 .

r? `@Amanieu`
  • Loading branch information
GuillaumeGomez authored Jul 19, 2021
2 parents 456ebd3 + f26fbe2 commit 65b7aa9
Show file tree
Hide file tree
Showing 5 changed files with 73 additions and 49 deletions.
32 changes: 31 additions & 1 deletion library/core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -316,5 +316,35 @@ pub mod primitive;
#[unstable(feature = "stdsimd", issue = "48556")]
mod core_arch;

#[doc = include_str!("../../stdarch/crates/core_arch/src/core_arch_docs.md")]
#[stable(feature = "simd_arch", since = "1.27.0")]
pub use core_arch::arch;
pub mod arch {
#[stable(feature = "simd_arch", since = "1.27.0")]
pub use crate::core_arch::arch::*;

/// Inline assembly.
///
/// Read the [unstable book] for the usage.
///
/// [unstable book]: ../../unstable-book/library-features/asm.html
#[unstable(
feature = "asm",
issue = "72016",
reason = "inline assembly is not stable enough for use and is subject to change"
)]
#[rustc_builtin_macro]
pub macro asm("assembly template", $(operands,)* $(options($(option),*))?) {
/* compiler built-in */
}
/// Module-level inline assembly.
#[unstable(
feature = "global_asm",
issue = "35119",
reason = "`global_asm!` is not stable enough for use and is subject to change"
)]
#[rustc_builtin_macro]
pub macro global_asm("assembly template", $(operands,)* $(options($(option),*))?) {
/* compiler built-in */
}
}
38 changes: 0 additions & 38 deletions library/core/src/macros/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1312,27 +1312,6 @@ pub(crate) mod builtin {
($cond:expr, $($arg:tt)+) => {{ /* compiler built-in */ }};
}

/// Inline assembly.
///
/// Read the [unstable book] for the usage.
///
/// [unstable book]: ../unstable-book/library-features/asm.html
#[unstable(
feature = "asm",
issue = "72016",
reason = "inline assembly is not stable enough for use and is subject to change"
)]
#[rustc_builtin_macro]
#[macro_export]
macro_rules! asm {
("assembly template",
$(operands,)*
$(options($(option),*))?
) => {
/* compiler built-in */
};
}

/// LLVM-style inline assembly.
///
/// Read the [unstable book] for the usage.
Expand All @@ -1355,23 +1334,6 @@ pub(crate) mod builtin {
};
}

/// Module-level inline assembly.
#[unstable(
feature = "global_asm",
issue = "35119",
reason = "`global_asm!` is not stable enough for use and is subject to change"
)]
#[rustc_builtin_macro]
#[macro_export]
macro_rules! global_asm {
("assembly template",
$(operands,)*
$(options($(option),*))?
) => {
/* compiler built-in */
};
}

/// Prints passed tokens into the standard output.
#[unstable(
feature = "log_syntax",
Expand Down
22 changes: 19 additions & 3 deletions library/core/src/prelude/v1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,27 @@ pub use crate::hash::macros::Hash;
#[allow(deprecated)]
#[doc(no_inline)]
pub use crate::{
asm, assert, cfg, column, compile_error, concat, concat_idents, env, file, format_args,
format_args_nl, global_asm, include, include_bytes, include_str, line, llvm_asm, log_syntax,
module_path, option_env, stringify, trace_macros,
assert, cfg, column, compile_error, concat, concat_idents, env, file, format_args,
format_args_nl, include, include_bytes, include_str, line, llvm_asm, log_syntax, module_path,
option_env, stringify, trace_macros,
};

#[unstable(
feature = "asm",
issue = "72016",
reason = "inline assembly is not stable enough for use and is subject to change"
)]
#[doc(no_inline)]
pub use crate::arch::asm;

#[unstable(
feature = "global_asm",
issue = "35119",
reason = "`global_asm!` is not stable enough for use and is subject to change"
)]
#[doc(no_inline)]
pub use crate::arch::global_asm;

#[stable(feature = "builtin_macro_prelude", since = "1.38.0")]
#[allow(deprecated, deprecated_in_future)]
#[doc(no_inline)]
Expand Down
6 changes: 3 additions & 3 deletions library/std/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -556,9 +556,9 @@ pub use core::{
#[stable(feature = "builtin_macro_prelude", since = "1.38.0")]
#[allow(deprecated)]
pub use core::{
asm, assert, assert_matches, cfg, column, compile_error, concat, concat_idents, env, file,
format_args, format_args_nl, global_asm, include, include_bytes, include_str, line, llvm_asm,
log_syntax, module_path, option_env, stringify, trace_macros,
assert, assert_matches, cfg, column, compile_error, concat, concat_idents, env, file,
format_args, format_args_nl, include, include_bytes, include_str, line, llvm_asm, log_syntax,
module_path, option_env, stringify, trace_macros,
};

#[stable(feature = "core_primitive", since = "1.43.0")]
Expand Down
24 changes: 20 additions & 4 deletions library/std/src/prelude/v1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,28 @@ pub use crate::result::Result::{self, Err, Ok};
#[allow(deprecated)]
#[doc(no_inline)]
pub use core::prelude::v1::{
asm, assert, cfg, column, compile_error, concat, concat_idents, env, file, format_args,
format_args_nl, global_asm, include, include_bytes, include_str, line, llvm_asm, log_syntax,
module_path, option_env, stringify, trace_macros, Clone, Copy, Debug, Default, Eq, Hash, Ord,
PartialEq, PartialOrd,
assert, cfg, column, compile_error, concat, concat_idents, env, file, format_args,
format_args_nl, include, include_bytes, include_str, line, llvm_asm, log_syntax, module_path,
option_env, stringify, trace_macros, Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq,
PartialOrd,
};

#[unstable(
feature = "asm",
issue = "72016",
reason = "inline assembly is not stable enough for use and is subject to change"
)]
#[doc(no_inline)]
pub use core::prelude::v1::asm;

#[unstable(
feature = "global_asm",
issue = "35119",
reason = "`global_asm!` is not stable enough for use and is subject to change"
)]
#[doc(no_inline)]
pub use core::prelude::v1::global_asm;

// FIXME: Attribute and internal derive macros are not documented because for them rustdoc generates
// dead links which fail link checker testing.
#[stable(feature = "builtin_macro_prelude", since = "1.38.0")]
Expand Down

0 comments on commit 65b7aa9

Please sign in to comment.