Skip to content

Commit

Permalink
Auto merge of rust-lang#91728 - Amanieu:stable_asm, r=joshtriplett
Browse files Browse the repository at this point in the history
Stabilize asm! and global_asm!

Tracking issue: rust-lang#72016

It's been almost 2 years since the original [RFC](rust-lang/rfcs#2850) was posted and we're finally ready to stabilize this feature!

The main changes in this PR are:
- Removing `asm!` and `global_asm!` from the prelude as per the decision in rust-lang#87228.
- Stabilizing the `asm` and `global_asm` features.
- Removing the unstable book pages for `asm` and `global_asm`. The contents are moved to the [reference](rust-lang/reference#1105) and [rust by example](rust-lang/rust-by-example#1483).
  - All links to these pages have been removed to satisfy the link checker. In a later PR these will be replaced with links to the reference or rust by example.
- Removing the automatic suggestion for using `llvm_asm!` instead of `asm!` if you're still using the old syntax, since it doesn't work anymore with `asm!` no longer being in the prelude. This only affects code that predates the old LLVM-style `asm!` being renamed to `llvm_asm!`.
- Updating `stdarch` and `compiler-builtins`.
- Updating all the tests.

r? `@joshtriplett`
  • Loading branch information
bors committed Dec 14, 2021
2 parents 41c48bd + e1139cf commit 6b6cc5d
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 32 deletions.
4 changes: 2 additions & 2 deletions tests/ui/asm_syntax.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
// only-x86_64
// ignore-aarch64

#![feature(asm)]

#[warn(clippy::inline_asm_x86_intel_syntax)]
mod warn_intel {
pub(super) unsafe fn use_asm() {
use std::arch::asm;
asm!("");
asm!("", options());
asm!("", options(nostack));
Expand All @@ -17,6 +16,7 @@ mod warn_intel {
#[warn(clippy::inline_asm_x86_att_syntax)]
mod warn_att {
pub(super) unsafe fn use_asm() {
use std::arch::asm;
asm!("");
asm!("", options());
asm!("", options(nostack));
Expand Down
6 changes: 3 additions & 3 deletions tests/ui/asm_syntax.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error: Intel x86 assembly syntax used
--> $DIR/asm_syntax.rs:9:9
--> $DIR/asm_syntax.rs:8:9
|
LL | asm!("");
| ^^^^^^^^
Expand All @@ -8,15 +8,15 @@ LL | asm!("");
= help: use AT&T x86 assembly syntax

error: Intel x86 assembly syntax used
--> $DIR/asm_syntax.rs:10:9
--> $DIR/asm_syntax.rs:9:9
|
LL | asm!("", options());
| ^^^^^^^^^^^^^^^^^^^
|
= help: use AT&T x86 assembly syntax

error: Intel x86 assembly syntax used
--> $DIR/asm_syntax.rs:11:9
--> $DIR/asm_syntax.rs:10:9
|
LL | asm!("", options(nostack));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/entry.fixed
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

#![allow(unused, clippy::needless_pass_by_value, clippy::collapsible_if)]
#![warn(clippy::map_entry)]
#![feature(asm)]

use std::arch::asm;
use std::collections::HashMap;
use std::hash::Hash;

Expand Down
2 changes: 1 addition & 1 deletion tests/ui/entry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

#![allow(unused, clippy::needless_pass_by_value, clippy::collapsible_if)]
#![warn(clippy::map_entry)]
#![feature(asm)]

use std::arch::asm;
use std::collections::HashMap;
use std::hash::Hash;

Expand Down
3 changes: 2 additions & 1 deletion tests/ui/missing-doc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
// When denying at the crate level, be sure to not get random warnings from the
// injected intrinsics by the compiler.
#![allow(dead_code)]
#![feature(global_asm)]
//! Some garbage docs for the crate here
#![doc = "More garbage"]

use std::arch::global_asm;

type Typedef = String;
pub type PubTypedef = String;

Expand Down
48 changes: 24 additions & 24 deletions tests/ui/missing-doc.stderr
Original file line number Diff line number Diff line change
@@ -1,43 +1,43 @@
error: missing documentation for a type alias
--> $DIR/missing-doc.rs:9:1
--> $DIR/missing-doc.rs:10:1
|
LL | type Typedef = String;
| ^^^^^^^^^^^^^^^^^^^^^^
|
= note: `-D clippy::missing-docs-in-private-items` implied by `-D warnings`

error: missing documentation for a type alias
--> $DIR/missing-doc.rs:10:1
--> $DIR/missing-doc.rs:11:1
|
LL | pub type PubTypedef = String;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: missing documentation for a module
--> $DIR/missing-doc.rs:12:1
--> $DIR/missing-doc.rs:13:1
|
LL | mod module_no_dox {}
| ^^^^^^^^^^^^^^^^^^^^

error: missing documentation for a module
--> $DIR/missing-doc.rs:13:1
--> $DIR/missing-doc.rs:14:1
|
LL | pub mod pub_module_no_dox {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: missing documentation for a function
--> $DIR/missing-doc.rs:17:1
--> $DIR/missing-doc.rs:18:1
|
LL | pub fn foo2() {}
| ^^^^^^^^^^^^^^^^

error: missing documentation for a function
--> $DIR/missing-doc.rs:18:1
--> $DIR/missing-doc.rs:19:1
|
LL | fn foo3() {}
| ^^^^^^^^^^^^

error: missing documentation for an enum
--> $DIR/missing-doc.rs:32:1
--> $DIR/missing-doc.rs:33:1
|
LL | / enum Baz {
LL | | BazA { a: isize, b: isize },
Expand All @@ -46,75 +46,75 @@ LL | | }
| |_^

error: missing documentation for a variant
--> $DIR/missing-doc.rs:33:5
--> $DIR/missing-doc.rs:34:5
|
LL | BazA { a: isize, b: isize },
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: missing documentation for a struct field
--> $DIR/missing-doc.rs:33:12
--> $DIR/missing-doc.rs:34:12
|
LL | BazA { a: isize, b: isize },
| ^^^^^^^^

error: missing documentation for a struct field
--> $DIR/missing-doc.rs:33:22
--> $DIR/missing-doc.rs:34:22
|
LL | BazA { a: isize, b: isize },
| ^^^^^^^^

error: missing documentation for a variant
--> $DIR/missing-doc.rs:34:5
--> $DIR/missing-doc.rs:35:5
|
LL | BarB,
| ^^^^

error: missing documentation for an enum
--> $DIR/missing-doc.rs:37:1
--> $DIR/missing-doc.rs:38:1
|
LL | / pub enum PubBaz {
LL | | PubBazA { a: isize },
LL | | }
| |_^

error: missing documentation for a variant
--> $DIR/missing-doc.rs:38:5
--> $DIR/missing-doc.rs:39:5
|
LL | PubBazA { a: isize },
| ^^^^^^^^^^^^^^^^^^^^

error: missing documentation for a struct field
--> $DIR/missing-doc.rs:38:15
--> $DIR/missing-doc.rs:39:15
|
LL | PubBazA { a: isize },
| ^^^^^^^^

error: missing documentation for a constant
--> $DIR/missing-doc.rs:58:1
--> $DIR/missing-doc.rs:59:1
|
LL | const FOO: u32 = 0;
| ^^^^^^^^^^^^^^^^^^^

error: missing documentation for a constant
--> $DIR/missing-doc.rs:65:1
--> $DIR/missing-doc.rs:66:1
|
LL | pub const FOO4: u32 = 0;
| ^^^^^^^^^^^^^^^^^^^^^^^^

error: missing documentation for a static
--> $DIR/missing-doc.rs:67:1
--> $DIR/missing-doc.rs:68:1
|
LL | static BAR: u32 = 0;
| ^^^^^^^^^^^^^^^^^^^^

error: missing documentation for a static
--> $DIR/missing-doc.rs:74:1
--> $DIR/missing-doc.rs:75:1
|
LL | pub static BAR4: u32 = 0;
| ^^^^^^^^^^^^^^^^^^^^^^^^^

error: missing documentation for a module
--> $DIR/missing-doc.rs:76:1
--> $DIR/missing-doc.rs:77:1
|
LL | / mod internal_impl {
LL | | /// dox
Expand All @@ -126,31 +126,31 @@ LL | | }
| |_^

error: missing documentation for a function
--> $DIR/missing-doc.rs:79:5
--> $DIR/missing-doc.rs:80:5
|
LL | pub fn undocumented1() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^

error: missing documentation for a function
--> $DIR/missing-doc.rs:80:5
--> $DIR/missing-doc.rs:81:5
|
LL | pub fn undocumented2() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^

error: missing documentation for a function
--> $DIR/missing-doc.rs:81:5
--> $DIR/missing-doc.rs:82:5
|
LL | fn undocumented3() {}
| ^^^^^^^^^^^^^^^^^^^^^

error: missing documentation for a function
--> $DIR/missing-doc.rs:86:9
--> $DIR/missing-doc.rs:87:9
|
LL | pub fn also_undocumented1() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: missing documentation for a function
--> $DIR/missing-doc.rs:87:9
--> $DIR/missing-doc.rs:88:9
|
LL | fn also_undocumented2() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand Down

0 comments on commit 6b6cc5d

Please sign in to comment.