Skip to content

Commit 2599e6c

Browse files
committed
pointers_in_nomem_asm_block: finishing touches
1 parent 5f44d9e commit 2599e6c

File tree

6 files changed

+26
-26
lines changed

6 files changed

+26
-26
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5714,7 +5714,7 @@ Released 2018-09-13
57145714
[`path_ends_with_ext`]: https://rust-lang.github.io/rust-clippy/master/index.html#path_ends_with_ext
57155715
[`pattern_type_mismatch`]: https://rust-lang.github.io/rust-clippy/master/index.html#pattern_type_mismatch
57165716
[`permissions_set_readonly_false`]: https://rust-lang.github.io/rust-clippy/master/index.html#permissions_set_readonly_false
5717-
[`pointer_in_nomem_asm_block`]: https://rust-lang.github.io/rust-clippy/master/index.html#pointer_in_nomem_asm_block
5717+
[`pointers_in_nomem_asm_block`]: https://rust-lang.github.io/rust-clippy/master/index.html#pointers_in_nomem_asm_block
57185718
[`positional_named_format_parameters`]: https://rust-lang.github.io/rust-clippy/master/index.html#positional_named_format_parameters
57195719
[`possible_missing_comma`]: https://rust-lang.github.io/rust-clippy/master/index.html#possible_missing_comma
57205720
[`precedence`]: https://rust-lang.github.io/rust-clippy/master/index.html#precedence

clippy_lints/src/declared_lints.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -600,7 +600,7 @@ pub(crate) static LINTS: &[&crate::LintInfo] = &[
600600
crate::pass_by_ref_or_value::TRIVIALLY_COPY_PASS_BY_REF_INFO,
601601
crate::pattern_type_mismatch::PATTERN_TYPE_MISMATCH_INFO,
602602
crate::permissions_set_readonly_false::PERMISSIONS_SET_READONLY_FALSE_INFO,
603-
crate::pointer_in_nomem_asm_block::POINTER_IN_NOMEM_ASM_BLOCK_INFO,
603+
crate::pointers_in_nomem_asm_block::POINTERS_IN_NOMEM_ASM_BLOCK_INFO,
604604
crate::precedence::PRECEDENCE_INFO,
605605
crate::ptr::CMP_NULL_INFO,
606606
crate::ptr::INVALID_NULL_PTR_USAGE_INFO,

clippy_lints/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ mod partialeq_to_none;
289289
mod pass_by_ref_or_value;
290290
mod pattern_type_mismatch;
291291
mod permissions_set_readonly_false;
292-
mod pointer_in_nomem_asm_block;
292+
mod pointers_in_nomem_asm_block;
293293
mod precedence;
294294
mod ptr;
295295
mod ptr_offset_with_cast;
@@ -1177,7 +1177,7 @@ pub fn register_lints(store: &mut rustc_lint::LintStore, conf: &'static Conf) {
11771177
store.register_late_pass(|_| Box::new(set_contains_or_insert::HashsetInsertAfterContains));
11781178
store.register_early_pass(|| Box::new(byte_char_slices::ByteCharSlice));
11791179
store.register_early_pass(|| Box::new(cfg_not_test::CfgNotTest));
1180-
store.register_late_pass(|_| Box::new(pointer_in_nomem_asm_block::PointerInNomemAsmBlock));
1180+
store.register_late_pass(|_| Box::new(pointers_in_nomem_asm_block::PointersInNomemAsmBlock));
11811181
// add lints here, do not remove this comment, it's used in `new_lint`
11821182
}
11831183

clippy_lints/src/pointer_in_nomem_asm_block.rs renamed to clippy_lints/src/pointers_in_nomem_asm_block.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,14 @@ declare_clippy_lint! {
2626
/// }
2727
/// ```
2828
#[clippy::version = "1.81.0"]
29-
pub POINTER_IN_NOMEM_ASM_BLOCK,
29+
pub POINTERS_IN_NOMEM_ASM_BLOCK,
3030
suspicious,
31-
"pointer in nomem asm block"
31+
"pointers in nomem asm block"
3232
}
3333

34-
declare_lint_pass!(PointerInNomemAsmBlock => [POINTER_IN_NOMEM_ASM_BLOCK]);
34+
declare_lint_pass!(PointersInNomemAsmBlock => [POINTERS_IN_NOMEM_ASM_BLOCK]);
3535

36-
impl<'tcx> LateLintPass<'tcx> for PointerInNomemAsmBlock {
36+
impl<'tcx> LateLintPass<'tcx> for PointersInNomemAsmBlock {
3737
fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &Expr<'tcx>) {
3838
if let ExprKind::InlineAsm(asm) = &expr.kind {
3939
check_asm(cx, asm);
@@ -59,9 +59,9 @@ fn check_asm(cx: &LateContext<'_>, asm: &InlineAsm<'_>) {
5959

6060
span_lint_and_then(
6161
cx,
62-
POINTER_IN_NOMEM_ASM_BLOCK,
62+
POINTERS_IN_NOMEM_ASM_BLOCK,
6363
spans,
64-
"passing pointer to nomem asm block",
64+
"passing pointers to nomem asm block",
6565
additional_notes,
6666
);
6767
}
@@ -83,6 +83,6 @@ fn has_in_operand_pointer(cx: &LateContext<'_>, asm_op: &InlineAsmOperand<'_>) -
8383
}
8484

8585
fn additional_notes(diag: &mut rustc_errors::Diag<'_, ()>) {
86-
diag.note("`nomem` means that no memory write or read happens inside them asm! block");
86+
diag.note("`nomem` means that no memory write or read happens inside the asm! block");
8787
diag.note("if this is intentional and no pointers are read or written to, consider allowing the lint");
8888
}

tests/ui/pointer_in_nomem_asm_block.rs renamed to tests/ui/pointers_in_nomem_asm_block.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//@ needs-asm-support
2-
#![warn(clippy::pointer_in_nomem_asm_block)]
2+
#![warn(clippy::pointers_in_nomem_asm_block)]
33
#![crate_type = "lib"]
44
#![no_std]
55

@@ -9,7 +9,7 @@ unsafe fn nomem_bad(p: &i32) {
99
asm!(
1010
"asdf {p1}, {p2}, {p3}",
1111
p1 = in(reg) p,
12-
//~^ ERROR: passing pointer to nomem asm block
12+
//~^ ERROR: passing pointers to nomem asm block
1313
p2 = in(reg) p as *const _ as usize,
1414
p3 = in(reg) p,
1515
options(nomem, nostack, preserves_flags)
@@ -24,10 +24,10 @@ unsafe fn nomem_good(p: &i32) {
2424

2525
unsafe fn nomem_bad2(p: &mut i32) {
2626
asm!("asdf {p}", p = in(reg) p, options(nomem, nostack, preserves_flags));
27-
//~^ ERROR: passing pointer to nomem asm block
27+
//~^ ERROR: passing pointers to nomem asm block
2828
}
2929

3030
unsafe fn nomem_fn(p: extern "C" fn()) {
3131
asm!("call {p}", p = in(reg) p, options(nomem));
32-
//~^ ERROR: passing pointer to nomem asm block
32+
//~^ ERROR: passing pointers to nomem asm block
3333
}

tests/ui/pointer_in_nomem_asm_block.stderr renamed to tests/ui/pointers_in_nomem_asm_block.stderr

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,33 @@
1-
error: passing pointer to nomem asm block
2-
--> tests/ui/pointer_in_nomem_asm_block.rs:11:9
1+
error: passing pointers to nomem asm block
2+
--> tests/ui/pointers_in_nomem_asm_block.rs:11:9
33
|
44
LL | p1 = in(reg) p,
55
| ^^^^^^^^^^^^^^
66
...
77
LL | p3 = in(reg) p,
88
| ^^^^^^^^^^^^^^
99
|
10-
= note: `nomem` means that no memory write or read happens inside them asm! block
10+
= note: `nomem` means that no memory write or read happens inside the asm! block
1111
= note: if this is intentional and no pointers are read or written to, consider allowing the lint
12-
= note: `-D clippy::pointer-in-nomem-asm-block` implied by `-D warnings`
13-
= help: to override `-D warnings` add `#[allow(clippy::pointer_in_nomem_asm_block)]`
12+
= note: `-D clippy::pointers-in-nomem-asm-block` implied by `-D warnings`
13+
= help: to override `-D warnings` add `#[allow(clippy::pointers_in_nomem_asm_block)]`
1414

15-
error: passing pointer to nomem asm block
16-
--> tests/ui/pointer_in_nomem_asm_block.rs:26:22
15+
error: passing pointers to nomem asm block
16+
--> tests/ui/pointers_in_nomem_asm_block.rs:26:22
1717
|
1818
LL | asm!("asdf {p}", p = in(reg) p, options(nomem, nostack, preserves_flags));
1919
| ^^^^^^^^^^^^^
2020
|
21-
= note: `nomem` means that no memory write or read happens inside them asm! block
21+
= note: `nomem` means that no memory write or read happens inside the asm! block
2222
= note: if this is intentional and no pointers are read or written to, consider allowing the lint
2323

24-
error: passing pointer to nomem asm block
25-
--> tests/ui/pointer_in_nomem_asm_block.rs:31:22
24+
error: passing pointers to nomem asm block
25+
--> tests/ui/pointers_in_nomem_asm_block.rs:31:22
2626
|
2727
LL | asm!("call {p}", p = in(reg) p, options(nomem));
2828
| ^^^^^^^^^^^^^
2929
|
30-
= note: `nomem` means that no memory write or read happens inside them asm! block
30+
= note: `nomem` means that no memory write or read happens inside the asm! block
3131
= note: if this is intentional and no pointers are read or written to, consider allowing the lint
3232

3333
error: aborting due to 3 previous errors

0 commit comments

Comments
 (0)