Move named_asm_labels
to a HIR lint
This commit is contained in:
parent
f66e825f73
commit
0b81c2eb82
10 changed files with 304 additions and 147 deletions
|
@ -2468,38 +2468,6 @@ declare_lint! {
|
|||
"incorrect use of inline assembly",
|
||||
}
|
||||
|
||||
declare_lint! {
|
||||
/// The `named_asm_labels` lint detects the use of named labels in the
|
||||
/// inline `asm!` macro.
|
||||
///
|
||||
/// ### Example
|
||||
///
|
||||
/// ```rust,compile_fail
|
||||
/// fn main() {
|
||||
/// unsafe {
|
||||
/// asm!("foo: bar");
|
||||
/// }
|
||||
/// }
|
||||
/// ```
|
||||
///
|
||||
/// {{produces}}
|
||||
///
|
||||
/// ### Explanation
|
||||
///
|
||||
/// LLVM is allowed to duplicate inline assembly blocks for any
|
||||
/// reason, for example when it is in a function that gets inlined. Because
|
||||
/// of this, GNU assembler [local labels] *must* be used instead of labels
|
||||
/// with a name. Using named labels might cause assembler or linker errors.
|
||||
///
|
||||
/// See the [unstable book] for more details.
|
||||
///
|
||||
/// [local labels]: https://sourceware.org/binutils/docs/as/Symbol-Names.html#Local-Labels
|
||||
/// [unstable book]: https://doc.rust-lang.org/nightly/unstable-book/library-features/asm.html#labels
|
||||
pub NAMED_ASM_LABELS,
|
||||
Deny,
|
||||
"named labels in inline assembly",
|
||||
}
|
||||
|
||||
declare_lint! {
|
||||
/// The `unsafe_op_in_unsafe_fn` lint detects unsafe operations in unsafe
|
||||
/// functions without an explicit unsafe block.
|
||||
|
@ -3020,7 +2988,6 @@ declare_lint_pass! {
|
|||
INLINE_NO_SANITIZE,
|
||||
BAD_ASM_STYLE,
|
||||
ASM_SUB_REGISTER,
|
||||
NAMED_ASM_LABELS,
|
||||
UNSAFE_OP_IN_UNSAFE_FN,
|
||||
INCOMPLETE_INCLUDE,
|
||||
CENUM_IMPL_DROP_CAST,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue