Skip to content

Commit

Permalink
Question 14 triggers non_local_definitions warning in 1.83-nightly (a…
Browse files Browse the repository at this point in the history
…gain)

    warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
      --> questions/014-trait-autoref.rs:20:13
       |
    11 | fn main() {
       | --------- move the `impl` block outside of this function `main`
    ...
    20 |             impl Trait for char {
       |             ^^^^^-----^^^^^^^^^
       |                  |
       |                  `Trait` is not local
       |
       = note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
       = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <rust-lang/rust#120363>
       = note: `#[warn(non_local_definitions)]` on by default

An earlier iteration of this warning previously appeared in 1.79-nightly
but was reverted.
  • Loading branch information
dtolnay committed Sep 25, 2024
1 parent 911ba91 commit 89cbf30
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions questions/014-trait-autoref.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
Answer: 10
Difficulty: 1
Warnings: non_local_definitions

# Hint

Expand Down

0 comments on commit 89cbf30

Please sign in to comment.