-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Stabilize asm! and global_asm! #91728
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
b3a5537
Remove automatic rustfix of asm! to llvm_asm!
Amanieu 44a3a66
Stabilize asm! and global_asm!
Amanieu 0dcd812
Re-bless asm tests for aarch64
Amanieu 1c48025
Address review feedback
Amanieu 76cd709
Fix unused import in test
Amanieu ead68f0
Fix clippy tests
Amanieu d1204ac
Remove invalid doc links.
Amanieu 6ab488a
Fix lint examples on non-x86_64
Amanieu d6f4da9
Disable asm lint example tests since they only work on x86_64
Amanieu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
//! Codegen of [`asm!`] invocations. | ||
//! Codegen of `asm!` invocations. | ||
|
||
use crate::prelude::*; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,8 +3,6 @@ | |
// Run-time: | ||
// status: 0 | ||
|
||
#![feature(asm, global_asm)] | ||
|
||
global_asm!(" | ||
.global add_asm | ||
add_asm: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -2419,8 +2419,9 @@ declare_lint! { | |||||
/// | ||||||
/// ### Example | ||||||
/// | ||||||
/// ```rust,ignore (fails on system llvm) | ||||||
/// #![feature(asm)] | ||||||
/// ```rust,ignore (fails on non-x86_64) | ||||||
/// #[cfg(target_arch="x86_64")] | ||||||
/// use std::arch::asm; | ||||||
/// | ||||||
/// fn main() { | ||||||
/// #[cfg(target_arch="x86_64")] | ||||||
|
@@ -2430,19 +2431,7 @@ declare_lint! { | |||||
/// } | ||||||
/// ``` | ||||||
/// | ||||||
/// This will produce: | ||||||
/// | ||||||
/// ```text | ||||||
/// warning: formatting may not be suitable for sub-register argument | ||||||
/// --> src/main.rs:6:19 | ||||||
/// | | ||||||
/// 6 | asm!("mov {0}, {0}", in(reg) 0i16); | ||||||
/// | ^^^ ^^^ ---- for this argument | ||||||
/// | | ||||||
/// = note: `#[warn(asm_sub_register)]` on by default | ||||||
/// = help: use the `x` modifier to have the register formatted as `ax` | ||||||
/// = help: or use the `r` modifier to keep the default formatting of `rax` | ||||||
/// ``` | ||||||
/// {{produces}} | ||||||
/// | ||||||
/// ### Explanation | ||||||
/// | ||||||
|
@@ -2455,10 +2444,6 @@ declare_lint! { | |||||
/// register size, to alert you of possibly using the incorrect width. To | ||||||
/// fix this, add the suggested modifier to the template, or cast the | ||||||
/// value to the correct size. | ||||||
/// | ||||||
/// See [register template modifiers] for more details. | ||||||
/// | ||||||
/// [register template modifiers]: https://doc.rust-lang.org/nightly/unstable-book/library-features/asm.html#register-template-modifiers | ||||||
pub ASM_SUB_REGISTER, | ||||||
Warn, | ||||||
"using only a subset of a register for inline asm inputs", | ||||||
|
@@ -2470,34 +2455,22 @@ declare_lint! { | |||||
/// | ||||||
/// ### Example | ||||||
/// | ||||||
/// ```rust,ignore (fails on system llvm) | ||||||
/// #![feature(asm)] | ||||||
/// ```rust,ignore (fails on non-x86_64) | ||||||
/// #[cfg(target_arch="x86_64")] | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That won't work. The tests are checking that the lint actually triggers in the example, but it only triggers on x86_64. |
||||||
/// use std::arch::asm; | ||||||
/// | ||||||
/// fn main() { | ||||||
/// #[cfg(target_arch="x86_64")] | ||||||
/// unsafe { | ||||||
/// asm!( | ||||||
/// ".att_syntax", | ||||||
/// "movl {0}, {0}", in(reg) 0usize | ||||||
/// "movq %{0}, %{0}", in(reg) 0usize | ||||||
/// ); | ||||||
/// } | ||||||
/// } | ||||||
/// ``` | ||||||
/// | ||||||
/// This will produce: | ||||||
/// | ||||||
/// ```text | ||||||
/// warning: avoid using `.att_syntax`, prefer using `options(att_syntax)` instead | ||||||
/// --> test.rs:7:14 | ||||||
/// | | ||||||
/// 7 | ".att_syntax", | ||||||
/// | ^^^^^^^^^^^ | ||||||
/// 8 | "movq {0}, {0}", out(reg) _, | ||||||
/// 9 | ); | ||||||
/// | - help: add option: `, options(att_syntax)` | ||||||
/// | | ||||||
/// = note: `#[warn(bad_asm_style)]` on by default | ||||||
/// ``` | ||||||
/// {{produces}} | ||||||
/// | ||||||
/// ### Explanation | ||||||
/// | ||||||
|
@@ -2739,7 +2712,8 @@ declare_lint! { | |||||
/// | ||||||
/// ```rust | ||||||
/// #![feature(naked_functions)] | ||||||
/// #![feature(asm)] | ||||||
/// | ||||||
/// use std::arch::asm; | ||||||
/// | ||||||
/// #[naked] | ||||||
/// pub fn default_abi() -> u32 { | ||||||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule stdarch
updated
16 files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In case anyone's wondering: yes, I made a typo when publishing a new version of compiler-builtins.