Skip to content

Port lint attributes to attribute parser#152369

Open
Bryntet wants to merge 10 commits intorust-lang:mainfrom
Bryntet:lint_attrs
Open

Port lint attributes to attribute parser#152369
Bryntet wants to merge 10 commits intorust-lang:mainfrom
Bryntet:lint_attrs

Conversation

@Bryntet
Copy link
Contributor

@Bryntet Bryntet commented Feb 9, 2026

View all comments

Tracking issue: #131229

Ports #[allow], #[deny], #[expect], #[forbid], and #[warn] to being parsed attrs

I tried my best to make this PR as small as possible, it was difficult. I hope it isn't too difficult to review

r? @JonathanBrouwer
r? @jdonszelmann

@rustbot rustbot added A-attributes Area: Attributes (`#[…]`, `#![…]`) S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Feb 9, 2026
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rustbot rustbot added the T-clippy Relevant to the Clippy team. label Feb 22, 2026
@Bryntet Bryntet changed the title lint attrs Port lint attributes to attribute parser Feb 22, 2026
@Bryntet Bryntet marked this pull request as ready for review February 22, 2026 18:57
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Feb 22, 2026
@rustbot
Copy link
Collaborator

rustbot commented Feb 22, 2026

Some changes occurred in src/tools/clippy

cc @rust-lang/clippy

Some changes occurred in compiler/rustc_hir/src/attrs

cc @jdonszelmann, @JonathanBrouwer

Some changes occurred in compiler/rustc_passes/src/check_attr.rs

cc @jdonszelmann, @JonathanBrouwer

Some changes occurred in compiler/rustc_attr_parsing

cc @jdonszelmann, @JonathanBrouwer

@rustbot rustbot removed the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Feb 22, 2026
@JonathanBrouwer
Copy link
Contributor

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rust-bors

This comment has been minimized.

rust-bors bot pushed a commit that referenced this pull request Feb 22, 2026
Port lint attributes to attribute parser
@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Feb 22, 2026
@Bryntet Bryntet force-pushed the lint_attrs branch 2 times, most recently from e70b414 to d9434c9 Compare February 22, 2026 20:19
@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (1416e18): comparison URL.

Overall result: ❌✅ regressions and improvements - please read the text below

Benchmarking this pull request means it may be perf-sensitive – we'll automatically label it not fit for rolling up. You can override this, but we strongly advise not to, due to possible changes in compiler perf.

Next Steps: If you can justify the regressions found in this try perf run, please do so in sufficient writing along with @rustbot label: +perf-regression-triaged. If not, please fix the regressions and do another perf run. If its results are neutral or positive, the label will be automatically removed.

@bors rollup=never
@rustbot label: -S-waiting-on-perf +perf-regression

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

mean range count
Regressions ❌
(primary)
0.1% [0.1%, 0.1%] 1
Regressions ❌
(secondary)
0.4% [0.2%, 0.6%] 6
Improvements ✅
(primary)
-0.3% [-0.5%, -0.2%] 18
Improvements ✅
(secondary)
-0.3% [-0.6%, -0.0%] 33
All ❌✅ (primary) -0.3% [-0.5%, 0.1%] 19

Max RSS (memory usage)

Results (primary -1.0%, secondary 2.9%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
4.9% [1.3%, 8.8%] 6
Improvements ✅
(primary)
-1.0% [-2.1%, -0.4%] 5
Improvements ✅
(secondary)
-3.3% [-4.5%, -2.0%] 2
All ❌✅ (primary) -1.0% [-2.1%, -0.4%] 5

Cycles

Results (primary 2.9%, secondary 3.7%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
2.9% [2.1%, 4.4%] 9
Regressions ❌
(secondary)
4.8% [2.8%, 6.2%] 8
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-5.2% [-5.2%, -5.2%] 1
All ❌✅ (primary) 2.9% [2.1%, 4.4%] 9

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 485.223s -> 485.543s (0.07%)
Artifact size: 394.92 MiB -> 396.97 MiB (0.52%)

@rustbot rustbot added perf-regression Performance regression. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Mar 24, 2026
@rust-log-analyzer

This comment has been minimized.

@Bryntet
Copy link
Contributor Author

Bryntet commented Mar 25, 2026

@bors try

@rust-bors

This comment has been minimized.

rust-bors bot pushed a commit that referenced this pull request Mar 25, 2026
Port lint attributes to attribute parser
@JonathanBrouwer
Copy link
Contributor

@rust-timer queue

@rust-timer

This comment has been minimized.

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Mar 25, 2026
@Bryntet
Copy link
Contributor Author

Bryntet commented Mar 25, 2026

@rustbot ready

cc @jdonszelmann
since you asked for a ping when I had fixed the remaining comments from jonathan

another perf run is queued, because I made a change that hopefully has positive perf compared to the previous (made it so we consolidate all lint attrs into one LintAttributeKind, and then we sort it in finalize instead of having to allocate a new vector, sort it, and then sort that multiple times)

@rust-log-analyzer

This comment has been minimized.

@Bryntet
Copy link
Contributor Author

Bryntet commented Mar 25, 2026

apparently running ./x test wasn't enough to catch all issues, sorry.

@rustbot author

Bryntet added 6 commits March 25, 2026 15:12
also add attr_id to `Stable` variant directly, instead of having to
iterate over all the attrs on the hir_id to find it
…tr parser

also changes method `parse_limited_all` to take Iterator as an input,
to avoid needing to do expensive allocation
also removes E0452 and splits
`tests/rustdoc-ui/lints/renamed-lint-still-applies` into 2 tests

this is because of delayed warn lint being lost on compiler aborting on
error
also buffer any lints coming from pre-expansion, so that they are
emitted with proper lint level
@rust-bors
Copy link
Contributor

rust-bors bot commented Mar 25, 2026

☀️ Try build successful (CI)
Build commit: 196eb6d (196eb6dc5b065987b5111bc690fb1d337ac87395, parent: 8a703520e80d87d4423c01f9d4fbc9e5f6533a02)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (196eb6d): comparison URL.

Overall result: ✅ improvements - no action needed

Benchmarking this pull request means it may be perf-sensitive – we'll automatically label it not fit for rolling up. You can override this, but we strongly advise not to, due to possible changes in compiler perf.

@bors rollup=never
@rustbot label: -S-waiting-on-perf -perf-regression

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

mean range count
Regressions ❌
(primary)
0.1% [0.1%, 0.1%] 1
Regressions ❌
(secondary)
0.2% [0.2%, 0.3%] 3
Improvements ✅
(primary)
-0.3% [-0.5%, -0.2%] 16
Improvements ✅
(secondary)
-0.3% [-0.5%, -0.0%] 31
All ❌✅ (primary) -0.3% [-0.5%, 0.1%] 17

Max RSS (memory usage)

Results (primary -1.2%, secondary 2.8%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
0.6% [0.6%, 0.6%] 1
Regressions ❌
(secondary)
6.2% [3.9%, 9.5%] 5
Improvements ✅
(primary)
-1.5% [-2.4%, -0.9%] 5
Improvements ✅
(secondary)
-3.0% [-4.6%, -0.7%] 3
All ❌✅ (primary) -1.2% [-2.4%, 0.6%] 6

Cycles

Results (primary 3.4%, secondary 4.2%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
3.4% [2.4%, 4.1%] 6
Regressions ❌
(secondary)
4.2% [2.5%, 5.7%] 9
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 3.4% [2.4%, 4.1%] 6

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 482.838s -> 485.094s (0.47%)
Artifact size: 394.91 MiB -> 396.87 MiB (0.50%)

@rust-log-analyzer
Copy link
Collaborator

The job x86_64-gnu-tools failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
tests/ui-toml/macro_metavars_in_unsafe/default/test.rs ... ok
tests/ui-toml/macro_metavars_in_unsafe/private/test.rs ... ok

FAILED TEST: tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs (revision `default`)
command: CLIPPY_CONF_DIR="tests/ui-toml/undocumented_unsafe_blocks/default" RUSTC_ICE="0" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/clippy-driver" "--error-format=json" "--emit=metadata" "-Aunused" "-Ainternal_features" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Dwarnings" "-Ldependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/release/deps" "--sysroot=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui_test/0/tests/ui-toml/undocumented_unsafe_blocks" "tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs" "--extern" "proc_macro_unsafe=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui_test/0/tests/ui/auxiliary/libproc_macro_unsafe.so" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui_test/0/tests/ui/auxiliary" "--extern" "futures=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libfutures-fbb2c78a4397bb08.rlib" "--extern" "futures=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libfutures-fbb2c78a4397bb08.rmeta" "--extern" "itertools=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libitertools-08cb6de3a10b25d1.rlib" "--extern" "itertools=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libitertools-08cb6de3a10b25d1.rmeta" "--extern" "libc=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/liblibc-ac3195ae9071a567.rlib" "--extern" "libc=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/liblibc-ac3195ae9071a567.rmeta" "--extern" "parking_lot=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libparking_lot-cb20139ff7bab978.rlib" "--extern" "parking_lot=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libparking_lot-cb20139ff7bab978.rmeta" "--extern" "quote=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libquote-d52f64f9beb2b3e9.rlib" "--extern" "quote=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libquote-d52f64f9beb2b3e9.rmeta" "--extern" "regex=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libregex-099fa7d611da1769.rlib" "--extern" "regex=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libregex-099fa7d611da1769.rmeta" "--extern" "serde=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libserde-cc2552a331d3edc6.rlib" "--extern" "serde=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libserde-cc2552a331d3edc6.rmeta" "--extern" "syn=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libsyn-6fe3ac6a29af0bce.rlib" "--extern" "syn=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libsyn-6fe3ac6a29af0bce.rmeta" "--extern" "tokio=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libtokio-115c8b7669715635.rlib" "--extern" "tokio=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libtokio-115c8b7669715635.rmeta" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/debug/deps" "--edition" "2024" "--cfg=default" "-Cextra-filename=default"

error: actual output differed from expected
Execute `./x test src/tools/clippy --bless` to update `tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.default.stderr` to the actual output
--- tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.default.stderr
+++ <stderr output>
---
+   = note: `-D clippy::needless-return` implied by `-D warnings`
+   = help: to override `-D warnings` add `#[allow(clippy::needless_return)]`
+help: remove `return`
+   |
+LL -     return unsafe { h() };
+LL +     unsafe { h() }
+   |
+
 error: module has unnecessary safety comment
   --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:808:5
... 104 lines skipped ...
---

error: unsafe block missing a safety comment
##[error]  --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:337:19
   |
LL |     /* Safety: */ unsafe {}
   |                   ^^^^^^^^^
   |
   = help: consider adding a safety comment on the preceding line

error: unsafe block missing a safety comment
---

error: unsafe block missing a safety comment
##[error]  --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:347:14
   |
LL |     let _ = [unsafe { 14 }, unsafe { 15 }, 42, unsafe { 16 }];
   |              ^^^^^^^^^^^^^
   |
   = help: consider adding a safety comment on the preceding line

error: unsafe block missing a safety comment
##[error]  --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:347:29
   |
LL |     let _ = [unsafe { 14 }, unsafe { 15 }, 42, unsafe { 16 }];
   |                             ^^^^^^^^^^^^^
   |
   = help: consider adding a safety comment on the preceding line

error: unsafe block missing a safety comment
##[error]  --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:347:48
   |
LL |     let _ = [unsafe { 14 }, unsafe { 15 }, 42, unsafe { 16 }];
   |                                                ^^^^^^^^^^^^^
   |
   = help: consider adding a safety comment on the preceding line

error: unsafe block missing a safety comment
##[error]  --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:354:18
   |
LL |     let _ = (42, unsafe {}, "test", unsafe {});
   |                  ^^^^^^^^^
   |
   = help: consider adding a safety comment on the preceding line

error: unsafe block missing a safety comment
##[error]  --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:354:37
   |
LL |     let _ = (42, unsafe {}, "test", unsafe {});
   |                                     ^^^^^^^^^
   |
   = help: consider adding a safety comment on the preceding line

error: unsafe block missing a safety comment
##[error]  --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:360:14
   |
LL |     let _ = *unsafe { &42 };
   |              ^^^^^^^^^^^^^^
   |
   = help: consider adding a safety comment on the preceding line

error: unsafe block missing a safety comment
---

error: unsafe block missing a safety comment
##[error]  --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:378:14
   |
LL |     let _ = [unsafe {}; 5];
   |              ^^^^^^^^^
   |
   = help: consider adding a safety comment on the preceding line

error: unsafe block missing a safety comment
---

error: unsafe block missing a safety comment
##[error]  --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:394:8
   |
LL |     t!(unsafe {});
   |        ^^^^^^^^^
   |
   = help: consider adding a safety comment on the preceding line

error: unsafe block missing a safety comment
---

error: unsafe block missing a safety comment
##[error]  --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:432:20
   |
LL |     println!("{}", unsafe { String::from_utf8_unchecked(vec![]) });
   |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: consider adding a safety comment on the preceding line

error: unsafe impl missing a safety comment
---

error: unsafe impl missing a safety comment
##[error]  --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:448:9
   |
LL |         unsafe impl B for (u32) {}
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: consider adding a safety comment on the preceding line

error: unsafe impl missing a safety comment
##[error]  --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:470:13
   |
LL |             unsafe impl T for $t {}
   |             ^^^^^^^^^^^^^^^^^^^^^^^
...
LL |     no_safety_comment!(());
   |     ---------------------- in this macro invocation
   |
   = help: consider adding a safety comment on the preceding line
   = note: this error originates in the macro `no_safety_comment` (in Nightly builds, run with -Z macro-backtrace for more info)

error: unsafe impl missing a safety comment
##[error]  --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:496:13
   |
LL |             unsafe impl T for $t {}
   |             ^^^^^^^^^^^^^^^^^^^^^^^
...
LL |     no_safety_comment!(());
   |     ---------------------- in this macro invocation
   |
   = help: consider adding a safety comment on the preceding line
   = note: this error originates in the macro `no_safety_comment` (in Nightly builds, run with -Z macro-backtrace for more info)

error: unsafe impl missing a safety comment
##[error]  --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:506:5
   |
LL |     unsafe impl T for (i32) {}
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: consider adding a safety comment on the preceding line

error: unsafe impl missing a safety comment
##[error]  --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:496:13
   |
LL |             unsafe impl T for $t {}
   |             ^^^^^^^^^^^^^^^^^^^^^^^
...
LL |     no_safety_comment!(u32);
   |     ----------------------- in this macro invocation
   |
   = help: consider adding a safety comment on the preceding line
   = note: this error originates in the macro `no_safety_comment` (in Nightly builds, run with -Z macro-backtrace for more info)

error: unsafe impl missing a safety comment
##[error]  --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:513:5
   |
LL |     unsafe impl T for (bool) {}
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: consider adding a safety comment on the preceding line

error: unsafe impl missing a safety comment
---

error: unsafe impl missing a safety comment
##[error]  --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:565:19
   |
LL |     /* SAFETY: */ unsafe impl InlineComment for () {}
   |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: consider adding a safety comment on the preceding line

error: unsafe impl missing a safety comment
---
   |
help: consider removing the safety comment
  --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:609:8
   |
LL |     // SAFETY: this is more than one level away, so it should warn
   |        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: unsafe block missing a safety comment
##[error]  --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:612:12
   |
---

error: unsafe block missing a safety comment
##[error]  --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:705:52
   |
LL |         const NO_SAFETY_IN_TRAIT_BUT_IN_IMPL: u8 = unsafe { 0 };
   |                                                    ^^^^^^^^^^^^
   |
   = help: consider adding a safety comment on the preceding line

error: unsafe block missing a safety comment
---

error: unsafe block missing a safety comment
##[error]  --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:729:40
   |
LL |         const NO_SAFETY_IN_IMPL: i32 = unsafe { 1 };
   |                                        ^^^^^^^^^^^^
   |
   = help: consider adding a safety comment on the preceding line

error: constant has unnecessary safety comment
##[error]  --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:768:5
   |
LL |     const UNIX_EPOCH_JULIAN_DAY: i32 =
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: consider removing the safety comment
  --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:766:8
   |
LL |     // SAFETY: fail ONLY if `accept-comment-above-attribute = false`
   |        ^^^^^^^

error: statement has unnecessary safety comment
##[error]  --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:788:5
   |
---
   = note: `-D clippy::needless-return` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(clippy::needless_return)]`
help: remove `return`
   |
LL -     return unsafe { h() };
LL +     unsafe { h() }
   |

error: module has unnecessary safety comment
##[error]  --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:808:5
   |
---
   |
LL |     unsafe fn unsafe_comment() {}
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: consider changing the `safety` comment for a `# Safety` doc comment
  --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:847:8
   |
LL |     // SAFETY: Bla
   |        ^^^^^^^

error: function has unnecessary safety comment
##[error]  --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:854:5
   |
LL |     unsafe fn unsafe_block_comment() {}
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: consider changing the `safety` comment for a `# Safety` doc comment
  --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:852:8
   |
LL |        SAFETY: Bla
   |        ^^^^^^^

---

error: there was 1 unmatched diagnostic
##[error]   --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:802:5
    |
802 |     return unsafe { h() };
    |     ^^^^^^^^^^^^^^^^^^^^^ Error[clippy::needless_return]: unneeded `return` statement
    |

full stderr:
error: unsafe block missing a safety comment
##[error]  --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:244:22
---

error: unsafe block missing a safety comment
##[error]  --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:337:19
   |
LL |     /* Safety: */ unsafe {}
   |                   ^^^^^^^^^
   |
   = help: consider adding a safety comment on the preceding line

error: unsafe block missing a safety comment
---

error: unsafe block missing a safety comment
##[error]  --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:347:14
   |
LL |     let _ = [unsafe { 14 }, unsafe { 15 }, 42, unsafe { 16 }];
   |              ^^^^^^^^^^^^^
   |
   = help: consider adding a safety comment on the preceding line

error: unsafe block missing a safety comment
##[error]  --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:347:29
   |
LL |     let _ = [unsafe { 14 }, unsafe { 15 }, 42, unsafe { 16 }];
   |                             ^^^^^^^^^^^^^
   |
   = help: consider adding a safety comment on the preceding line

error: unsafe block missing a safety comment
##[error]  --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:347:48
   |
LL |     let _ = [unsafe { 14 }, unsafe { 15 }, 42, unsafe { 16 }];
   |                                                ^^^^^^^^^^^^^
   |
   = help: consider adding a safety comment on the preceding line

error: unsafe block missing a safety comment
##[error]  --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:354:18
   |
LL |     let _ = (42, unsafe {}, "test", unsafe {});
   |                  ^^^^^^^^^
   |
   = help: consider adding a safety comment on the preceding line

error: unsafe block missing a safety comment
##[error]  --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:354:37
   |
LL |     let _ = (42, unsafe {}, "test", unsafe {});
   |                                     ^^^^^^^^^
   |
   = help: consider adding a safety comment on the preceding line

error: unsafe block missing a safety comment
##[error]  --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:360:14
   |
LL |     let _ = *unsafe { &42 };
   |              ^^^^^^^^^^^^^^
   |
   = help: consider adding a safety comment on the preceding line

error: unsafe block missing a safety comment
---

error: unsafe block missing a safety comment
##[error]  --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:378:14
   |
LL |     let _ = [unsafe {}; 5];
   |              ^^^^^^^^^
   |
   = help: consider adding a safety comment on the preceding line

error: unsafe block missing a safety comment
---

error: unsafe block missing a safety comment
##[error]  --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:394:8
   |
LL |     t!(unsafe {});
   |        ^^^^^^^^^
   |
   = help: consider adding a safety comment on the preceding line

error: unsafe block missing a safety comment
---

error: unsafe block missing a safety comment
##[error]  --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:432:20
   |
LL |     println!("{}", unsafe { String::from_utf8_unchecked(vec![]) });
   |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: consider adding a safety comment on the preceding line

error: unsafe impl missing a safety comment
---

error: unsafe impl missing a safety comment
##[error]  --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:448:9
   |
LL |         unsafe impl B for (u32) {}
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: consider adding a safety comment on the preceding line

error: unsafe impl missing a safety comment
##[error]  --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:470:13
   |
LL |             unsafe impl T for $t {}
   |             ^^^^^^^^^^^^^^^^^^^^^^^
...
LL |     no_safety_comment!(());
   |     ---------------------- in this macro invocation
   |
   = help: consider adding a safety comment on the preceding line
   = note: this error originates in the macro `no_safety_comment` (in Nightly builds, run with -Z macro-backtrace for more info)

error: unsafe impl missing a safety comment
##[error]  --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:496:13
   |
LL |             unsafe impl T for $t {}
   |             ^^^^^^^^^^^^^^^^^^^^^^^
...
LL |     no_safety_comment!(());
   |     ---------------------- in this macro invocation
   |
   = help: consider adding a safety comment on the preceding line
   = note: this error originates in the macro `no_safety_comment` (in Nightly builds, run with -Z macro-backtrace for more info)

error: unsafe impl missing a safety comment
##[error]  --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:506:5
   |
LL |     unsafe impl T for (i32) {}
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: consider adding a safety comment on the preceding line

error: unsafe impl missing a safety comment
##[error]  --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:496:13
   |
LL |             unsafe impl T for $t {}
   |             ^^^^^^^^^^^^^^^^^^^^^^^
...
LL |     no_safety_comment!(u32);
   |     ----------------------- in this macro invocation
   |
   = help: consider adding a safety comment on the preceding line
   = note: this error originates in the macro `no_safety_comment` (in Nightly builds, run with -Z macro-backtrace for more info)

error: unsafe impl missing a safety comment
##[error]  --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:513:5
   |
LL |     unsafe impl T for (bool) {}
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: consider adding a safety comment on the preceding line

error: unsafe impl missing a safety comment
---

error: unsafe impl missing a safety comment
##[error]  --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:565:19
   |
LL |     /* SAFETY: */ unsafe impl InlineComment for () {}
   |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: consider adding a safety comment on the preceding line

error: unsafe impl missing a safety comment
---
   |
help: consider removing the safety comment
  --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:609:8
   |
LL |     // SAFETY: this is more than one level away, so it should warn
   |        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: unsafe block missing a safety comment
##[error]  --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:612:12
   |
---

error: unsafe block missing a safety comment
##[error]  --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:705:52
   |
LL |         const NO_SAFETY_IN_TRAIT_BUT_IN_IMPL: u8 = unsafe { 0 };
   |                                                    ^^^^^^^^^^^^
   |
   = help: consider adding a safety comment on the preceding line

error: unsafe block missing a safety comment
---

error: unsafe block missing a safety comment
##[error]  --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:729:40
   |
LL |         const NO_SAFETY_IN_IMPL: i32 = unsafe { 1 };
   |                                        ^^^^^^^^^^^^
   |
   = help: consider adding a safety comment on the preceding line

error: constant has unnecessary safety comment
##[error]  --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:768:5
   |
LL |     const UNIX_EPOCH_JULIAN_DAY: i32 =
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: consider removing the safety comment
  --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:766:8
   |
LL |     // SAFETY: fail ONLY if `accept-comment-above-attribute = false`
   |        ^^^^^^^

error: statement has unnecessary safety comment
##[error]  --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:788:5
   |
---
   = note: `-D clippy::needless-return` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(clippy::needless_return)]`
help: remove `return`
   |
LL -     return unsafe { h() };
LL +     unsafe { h() }
   |

error: module has unnecessary safety comment
##[error]  --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:808:5
   |
---
   |
LL |     unsafe fn unsafe_comment() {}
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: consider changing the `safety` comment for a `# Safety` doc comment
  --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:847:8
   |
LL |     // SAFETY: Bla
   |        ^^^^^^^

error: function has unnecessary safety comment
##[error]  --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:854:5
   |
LL |     unsafe fn unsafe_block_comment() {}
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: consider changing the `safety` comment for a `# Safety` doc comment
  --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:852:8
   |
LL |        SAFETY: Bla
   |        ^^^^^^^

---



FAILED TEST: tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs (revision `disabled`)
command: CLIPPY_CONF_DIR="tests/ui-toml/undocumented_unsafe_blocks/disabled" RUSTC_ICE="0" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/clippy-driver" "--error-format=json" "--emit=metadata" "-Aunused" "-Ainternal_features" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Dwarnings" "-Ldependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/release/deps" "--sysroot=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui_test/0/tests/ui-toml/undocumented_unsafe_blocks" "tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs" "--extern" "proc_macro_unsafe=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui_test/0/tests/ui/auxiliary/libproc_macro_unsafe.so" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui_test/0/tests/ui/auxiliary" "--extern" "futures=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libfutures-fbb2c78a4397bb08.rlib" "--extern" "futures=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libfutures-fbb2c78a4397bb08.rmeta" "--extern" "itertools=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libitertools-08cb6de3a10b25d1.rlib" "--extern" "itertools=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libitertools-08cb6de3a10b25d1.rmeta" "--extern" "libc=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/liblibc-ac3195ae9071a567.rlib" "--extern" "libc=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/liblibc-ac3195ae9071a567.rmeta" "--extern" "parking_lot=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libparking_lot-cb20139ff7bab978.rlib" "--extern" "parking_lot=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libparking_lot-cb20139ff7bab978.rmeta" "--extern" "quote=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libquote-d52f64f9beb2b3e9.rlib" "--extern" "quote=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libquote-d52f64f9beb2b3e9.rmeta" "--extern" "regex=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libregex-099fa7d611da1769.rlib" "--extern" "regex=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libregex-099fa7d611da1769.rmeta" "--extern" "serde=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libserde-cc2552a331d3edc6.rlib" "--extern" "serde=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libserde-cc2552a331d3edc6.rmeta" "--extern" "syn=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libsyn-6fe3ac6a29af0bce.rlib" "--extern" "syn=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libsyn-6fe3ac6a29af0bce.rmeta" "--extern" "tokio=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libtokio-115c8b7669715635.rlib" "--extern" "tokio=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libtokio-115c8b7669715635.rmeta" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/debug/deps" "--edition" "2024" "--cfg=disabled" "-Cextra-filename=disabled"

error: actual output differed from expected
Execute `./x test src/tools/clippy --bless` to update `tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.disabled.stderr` to the actual output
--- tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.disabled.stderr
+++ <stderr output>
---
+   = note: `-D clippy::needless-return` implied by `-D warnings`
+   = help: to override `-D warnings` add `#[allow(clippy::needless_return)]`
+help: remove `return`
+   |
+LL -     return unsafe { h() };
+LL +     unsafe { h() }
+   |
+
 error: unsafe block missing a safety comment
   --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:802:12
... 84 lines skipped ...
---

error: unsafe block missing a safety comment
##[error]  --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:337:19
   |
LL |     /* Safety: */ unsafe {}
   |                   ^^^^^^^^^
   |
   = help: consider adding a safety comment on the preceding line

error: unsafe block missing a safety comment
---

error: unsafe block missing a safety comment
##[error]  --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:347:14
   |
LL |     let _ = [unsafe { 14 }, unsafe { 15 }, 42, unsafe { 16 }];
   |              ^^^^^^^^^^^^^
   |
   = help: consider adding a safety comment on the preceding line

error: unsafe block missing a safety comment
##[error]  --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:347:29
   |
LL |     let _ = [unsafe { 14 }, unsafe { 15 }, 42, unsafe { 16 }];
   |                             ^^^^^^^^^^^^^
   |
   = help: consider adding a safety comment on the preceding line

error: unsafe block missing a safety comment
##[error]  --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:347:48
   |
LL |     let _ = [unsafe { 14 }, unsafe { 15 }, 42, unsafe { 16 }];
   |                                                ^^^^^^^^^^^^^
   |
   = help: consider adding a safety comment on the preceding line

error: unsafe block missing a safety comment
##[error]  --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:354:18
   |
LL |     let _ = (42, unsafe {}, "test", unsafe {});
   |                  ^^^^^^^^^
   |
   = help: consider adding a safety comment on the preceding line

error: unsafe block missing a safety comment
##[error]  --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:354:37
   |
LL |     let _ = (42, unsafe {}, "test", unsafe {});
   |                                     ^^^^^^^^^
   |
   = help: consider adding a safety comment on the preceding line

error: unsafe block missing a safety comment
##[error]  --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:360:14
   |
LL |     let _ = *unsafe { &42 };
   |              ^^^^^^^^^^^^^^
   |
   = help: consider adding a safety comment on the preceding line

error: unsafe block missing a safety comment
---

error: unsafe block missing a safety comment
##[error]  --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:378:14
   |
LL |     let _ = [unsafe {}; 5];
   |              ^^^^^^^^^
   |
   = help: consider adding a safety comment on the preceding line

error: unsafe block missing a safety comment
---

error: unsafe block missing a safety comment
##[error]  --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:394:8
   |
LL |     t!(unsafe {});
   |        ^^^^^^^^^
   |
   = help: consider adding a safety comment on the preceding line

error: unsafe block missing a safety comment
---

error: unsafe block missing a safety comment
##[error]  --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:432:20
   |
LL |     println!("{}", unsafe { String::from_utf8_unchecked(vec![]) });
   |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: consider adding a safety comment on the preceding line

error: unsafe impl missing a safety comment
---

error: unsafe impl missing a safety comment
##[error]  --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:448:9
   |
LL |         unsafe impl B for (u32) {}
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: consider adding a safety comment on the preceding line

error: unsafe impl missing a safety comment
##[error]  --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:470:13
   |
LL |             unsafe impl T for $t {}
   |             ^^^^^^^^^^^^^^^^^^^^^^^
...
LL |     no_safety_comment!(());
   |     ---------------------- in this macro invocation
   |
   = help: consider adding a safety comment on the preceding line
   = note: this error originates in the macro `no_safety_comment` (in Nightly builds, run with -Z macro-backtrace for more info)

error: unsafe impl missing a safety comment
##[error]  --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:496:13
   |
LL |             unsafe impl T for $t {}
   |             ^^^^^^^^^^^^^^^^^^^^^^^
...
LL |     no_safety_comment!(());
   |     ---------------------- in this macro invocation
   |
   = help: consider adding a safety comment on the preceding line
   = note: this error originates in the macro `no_safety_comment` (in Nightly builds, run with -Z macro-backtrace for more info)

error: unsafe impl missing a safety comment
##[error]  --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:506:5
   |
LL |     unsafe impl T for (i32) {}
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: consider adding a safety comment on the preceding line

error: unsafe impl missing a safety comment
##[error]  --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:496:13
   |
LL |             unsafe impl T for $t {}
   |             ^^^^^^^^^^^^^^^^^^^^^^^
...
LL |     no_safety_comment!(u32);
   |     ----------------------- in this macro invocation
   |
   = help: consider adding a safety comment on the preceding line
   = note: this error originates in the macro `no_safety_comment` (in Nightly builds, run with -Z macro-backtrace for more info)

error: unsafe impl missing a safety comment
##[error]  --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:513:5
   |
LL |     unsafe impl T for (bool) {}
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: consider adding a safety comment on the preceding line

error: unsafe impl missing a safety comment
---

error: unsafe impl missing a safety comment
##[error]  --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:565:19
   |
LL |     /* SAFETY: */ unsafe impl InlineComment for () {}
   |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: consider adding a safety comment on the preceding line

error: unsafe impl missing a safety comment
---
   |
help: consider removing the safety comment
  --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:609:8
   |
LL |     // SAFETY: this is more than one level away, so it should warn
   |        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: unsafe block missing a safety comment
##[error]  --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:612:12
   |
---

error: unsafe block missing a safety comment
##[error]  --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:640:9
   |
LL |         unsafe { a_const_function_with_a_very_long_name_to_break_the_line() };
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: consider adding a safety comment on the preceding line

error: unsafe block missing a safety comment
##[error]  --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:645:9
   |
LL |         unsafe { a_const_function_with_a_very_long_name_to_break_the_line() };
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: consider adding a safety comment on the preceding line

error: unsafe block missing a safety comment
---

error: unsafe block missing a safety comment
##[error]  --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:671:9
   |
LL |         unsafe { a_const_function_with_a_very_long_name_to_break_the_line() };
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: consider adding a safety comment on the preceding line

error: unsafe block missing a safety comment
##[error]  --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:678:9
   |
LL |         unsafe { a_const_function_with_a_very_long_name_to_break_the_line() };
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: consider adding a safety comment on the preceding line

error: unsafe block missing a safety comment
---

error: unsafe block missing a safety comment
##[error]  --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:705:52
   |
LL |         const NO_SAFETY_IN_TRAIT_BUT_IN_IMPL: u8 = unsafe { 0 };
   |                                                    ^^^^^^^^^^^^
   |
   = help: consider adding a safety comment on the preceding line

error: unsafe block missing a safety comment
---

error: unsafe block missing a safety comment
##[error]  --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:729:40
   |
LL |         const NO_SAFETY_IN_IMPL: i32 = unsafe { 1 };
   |                                        ^^^^^^^^^^^^
   |
   = help: consider adding a safety comment on the preceding line

error: unsafe block missing a safety comment
---

error: unsafe block missing a safety comment
##[error]  --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:769:9
   |
LL |         unsafe { Date::__from_ordinal_date_unchecked(1970, 1) }.into_julian_day_just_make_this_line_longer();
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: consider adding a safety comment on the preceding line

error: statement has unnecessary safety comment
---
   = note: `-D clippy::needless-return` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(clippy::needless_return)]`
help: remove `return`
   |
LL -     return unsafe { h() };
LL +     unsafe { h() }
   |

error: unsafe block missing a safety comment
##[error]  --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:802:12
   |
---
   |
LL |     unsafe fn unsafe_comment() {}
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: consider changing the `safety` comment for a `# Safety` doc comment
  --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:847:8
   |
LL |     // SAFETY: Bla
   |        ^^^^^^^

error: function has unnecessary safety comment
##[error]  --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:854:5
   |
LL |     unsafe fn unsafe_block_comment() {}
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: consider changing the `safety` comment for a `# Safety` doc comment
  --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:852:8
   |
LL |        SAFETY: Bla
   |        ^^^^^^^

---

error: there was 1 unmatched diagnostic
##[error]   --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:802:5
    |
802 |     return unsafe { h() };
    |     ^^^^^^^^^^^^^^^^^^^^^ Error[clippy::needless_return]: unneeded `return` statement
    |

full stderr:
error: unsafe block missing a safety comment
##[error]  --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:244:22
---

error: unsafe block missing a safety comment
##[error]  --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:337:19
   |
LL |     /* Safety: */ unsafe {}
   |                   ^^^^^^^^^
   |
   = help: consider adding a safety comment on the preceding line

error: unsafe block missing a safety comment
---

error: unsafe block missing a safety comment
##[error]  --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:347:14
   |
LL |     let _ = [unsafe { 14 }, unsafe { 15 }, 42, unsafe { 16 }];
   |              ^^^^^^^^^^^^^
   |
   = help: consider adding a safety comment on the preceding line

error: unsafe block missing a safety comment
##[error]  --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:347:29
   |
LL |     let _ = [unsafe { 14 }, unsafe { 15 }, 42, unsafe { 16 }];
   |                             ^^^^^^^^^^^^^
   |
   = help: consider adding a safety comment on the preceding line

error: unsafe block missing a safety comment
##[error]  --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:347:48
   |
LL |     let _ = [unsafe { 14 }, unsafe { 15 }, 42, unsafe { 16 }];
   |                                                ^^^^^^^^^^^^^
   |
   = help: consider adding a safety comment on the preceding line

error: unsafe block missing a safety comment
##[error]  --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:354:18
   |
LL |     let _ = (42, unsafe {}, "test", unsafe {});
   |                  ^^^^^^^^^
   |
   = help: consider adding a safety comment on the preceding line

error: unsafe block missing a safety comment
##[error]  --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:354:37
   |
LL |     let _ = (42, unsafe {}, "test", unsafe {});
   |                                     ^^^^^^^^^
   |
   = help: consider adding a safety comment on the preceding line

error: unsafe block missing a safety comment
##[error]  --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:360:14
   |
LL |     let _ = *unsafe { &42 };
   |              ^^^^^^^^^^^^^^
   |
   = help: consider adding a safety comment on the preceding line

error: unsafe block missing a safety comment
---

error: unsafe block missing a safety comment
##[error]  --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:378:14
   |
LL |     let _ = [unsafe {}; 5];
   |              ^^^^^^^^^
   |
   = help: consider adding a safety comment on the preceding line

error: unsafe block missing a safety comment
---

error: unsafe block missing a safety comment
##[error]  --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:394:8
   |
LL |     t!(unsafe {});
   |        ^^^^^^^^^
   |
   = help: consider adding a safety comment on the preceding line

error: unsafe block missing a safety comment
---

error: unsafe block missing a safety comment
##[error]  --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:432:20
   |
LL |     println!("{}", unsafe { String::from_utf8_unchecked(vec![]) });
   |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: consider adding a safety comment on the preceding line

error: unsafe impl missing a safety comment
---

error: unsafe impl missing a safety comment
##[error]  --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:448:9
   |
LL |         unsafe impl B for (u32) {}
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: consider adding a safety comment on the preceding line

error: unsafe impl missing a safety comment
##[error]  --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:470:13
   |
LL |             unsafe impl T for $t {}
   |             ^^^^^^^^^^^^^^^^^^^^^^^
...
LL |     no_safety_comment!(());
   |     ---------------------- in this macro invocation
   |
   = help: consider adding a safety comment on the preceding line
   = note: this error originates in the macro `no_safety_comment` (in Nightly builds, run with -Z macro-backtrace for more info)

error: unsafe impl missing a safety comment
##[error]  --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:496:13
   |
LL |             unsafe impl T for $t {}
   |             ^^^^^^^^^^^^^^^^^^^^^^^
...
LL |     no_safety_comment!(());
   |     ---------------------- in this macro invocation
   |
   = help: consider adding a safety comment on the preceding line
   = note: this error originates in the macro `no_safety_comment` (in Nightly builds, run with -Z macro-backtrace for more info)

error: unsafe impl missing a safety comment
##[error]  --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:506:5
   |
LL |     unsafe impl T for (i32) {}
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: consider adding a safety comment on the preceding line

error: unsafe impl missing a safety comment
##[error]  --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:496:13
   |
LL |             unsafe impl T for $t {}
   |             ^^^^^^^^^^^^^^^^^^^^^^^
...
LL |     no_safety_comment!(u32);
   |     ----------------------- in this macro invocation
   |
   = help: consider adding a safety comment on the preceding line
   = note: this error originates in the macro `no_safety_comment` (in Nightly builds, run with -Z macro-backtrace for more info)

error: unsafe impl missing a safety comment
##[error]  --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:513:5
   |
LL |     unsafe impl T for (bool) {}
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: consider adding a safety comment on the preceding line

error: unsafe impl missing a safety comment
---

error: unsafe impl missing a safety comment
##[error]  --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:565:19
   |
LL |     /* SAFETY: */ unsafe impl InlineComment for () {}
   |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: consider adding a safety comment on the preceding line

error: unsafe impl missing a safety comment
---
   |
help: consider removing the safety comment
  --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:609:8
   |
LL |     // SAFETY: this is more than one level away, so it should warn
   |        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: unsafe block missing a safety comment
##[error]  --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:612:12
   |
---

error: unsafe block missing a safety comment
##[error]  --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:640:9
   |
LL |         unsafe { a_const_function_with_a_very_long_name_to_break_the_line() };
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: consider adding a safety comment on the preceding line

error: unsafe block missing a safety comment
##[error]  --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:645:9
   |
LL |         unsafe { a_const_function_with_a_very_long_name_to_break_the_line() };
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: consider adding a safety comment on the preceding line

error: unsafe block missing a safety comment
---

error: unsafe block missing a safety comment
##[error]  --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:671:9
   |
LL |         unsafe { a_const_function_with_a_very_long_name_to_break_the_line() };
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: consider adding a safety comment on the preceding line

error: unsafe block missing a safety comment
##[error]  --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:678:9
   |
LL |         unsafe { a_const_function_with_a_very_long_name_to_break_the_line() };
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: consider adding a safety comment on the preceding line

error: unsafe block missing a safety comment
---

error: unsafe block missing a safety comment
##[error]  --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:705:52
   |
LL |         const NO_SAFETY_IN_TRAIT_BUT_IN_IMPL: u8 = unsafe { 0 };
   |                                                    ^^^^^^^^^^^^
   |
   = help: consider adding a safety comment on the preceding line

error: unsafe block missing a safety comment
---

error: unsafe block missing a safety comment
##[error]  --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:729:40
   |
LL |         const NO_SAFETY_IN_IMPL: i32 = unsafe { 1 };
   |                                        ^^^^^^^^^^^^
   |
   = help: consider adding a safety comment on the preceding line

error: unsafe block missing a safety comment
---

error: unsafe block missing a safety comment
##[error]  --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:769:9
   |
LL |         unsafe { Date::__from_ordinal_date_unchecked(1970, 1) }.into_julian_day_just_make_this_line_longer();
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: consider adding a safety comment on the preceding line

error: statement has unnecessary safety comment
---
   = note: `-D clippy::needless-return` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(clippy::needless_return)]`
help: remove `return`
   |
LL -     return unsafe { h() };
LL +     unsafe { h() }
   |

error: unsafe block missing a safety comment
##[error]  --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:802:12
   |
---
   |
LL |     unsafe fn unsafe_comment() {}
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: consider changing the `safety` comment for a `# Safety` doc comment
  --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:847:8
   |
LL |     // SAFETY: Bla
   |        ^^^^^^^

error: function has unnecessary safety comment
##[error]  --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:854:5
   |
LL |     unsafe fn unsafe_block_comment() {}
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: consider changing the `safety` comment for a `# Safety` doc comment
  --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:852:8
   |
LL |        SAFETY: Bla
   |        ^^^^^^^

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-attributes Area: Attributes (`#[…]`, `#![…]`) S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-clippy Relevant to the Clippy team. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants