mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-23 21:23:56 +00:00
Auto merge of #91728 - Amanieu:stable_asm, r=joshtriplett
Stabilize asm! and global_asm! Tracking issue: #72016 It's been almost 2 years since the original [RFC](https://github.com/rust-lang/rfcs/pull/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 #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](https://github.com/rust-lang/reference/pull/1105) and [rust by example](https://github.com/rust-lang/rust-by-example/pull/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`
This commit is contained in:
commit
6b6cc5d576
6 changed files with 33 additions and 32 deletions
|
@ -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));
|
||||
|
@ -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));
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
error: Intel x86 assembly syntax used
|
||||
--> $DIR/asm_syntax.rs:9:9
|
||||
--> $DIR/asm_syntax.rs:8:9
|
||||
|
|
||||
LL | asm!("");
|
||||
| ^^^^^^^^
|
||||
|
@ -8,7 +8,7 @@ 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());
|
||||
| ^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -16,7 +16,7 @@ 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));
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
error: missing documentation for a type alias
|
||||
--> $DIR/missing-doc.rs:9:1
|
||||
--> $DIR/missing-doc.rs:10:1
|
||||
|
|
||||
LL | type Typedef = String;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -7,37 +7,37 @@ 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 },
|
||||
|
@ -46,31 +46,31 @@ 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 },
|
||||
|
@ -78,43 +78,43 @@ 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
|
||||
|
@ -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() {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
Loading…
Reference in a new issue