Skip to content

Commit

Permalink
tests: Fix non_local_definitions warning
Browse files Browse the repository at this point in the history
```
error: non-local `impl` definition, they should be avoided as they go against expectation
   --> tests/pinned_drop.rs:140:17
    |
140 | /                 impl S {
141 | |                     fn _f(self) -> Self {
142 | |                         self
143 | |                     }
144 | |                 }
    | |_________________^
    |
    = help: move this `impl` block outside the of the current function `__drop_inner` and up 3 bodies
    = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block
    = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type
    = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <rust-lang/rust#120363>
    = note: `-D non-local-definitions` implied by `-D warnings`
    = help: to override `-D warnings` add `#[allow(non_local_definitions)]`
```
  • Loading branch information
taiki-e committed Feb 26, 2024
1 parent d42e9cc commit cb24a63
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions tests/pinned_drop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,8 @@ fn self_inside_macro_containing_fn() {
impl PinnedDrop for S {
fn drop(self: Pin<&mut Self>) {
mac!({
#[allow(dead_code)]
struct S(());
impl S {
fn _f(self) -> Self {
self
Expand Down

0 comments on commit cb24a63

Please sign in to comment.