Skip to content

Commit 85c7849

Browse files
committed
Address closures as well
1 parent 5d5304e commit 85c7849

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

text/3373-avoid-nonlocal-definitions-in-fns.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,12 @@ relevant definitions.
2828
[explanation]: #explanation
2929

3030
Starting in the Rust 2024 edition:
31-
- An item nested inside a `fn` (through any level of nesting) may not define an
32-
`impl Type` block unless the `Type` is also nested inside the same `fn`.
33-
- An item nested inside a `fn` (through any level of nesting) may not define an
34-
`impl Trait for Type` unless either the `Trait` or the `Type` is also nested
35-
inside the same `fn`.
31+
- An item nested inside a function or closure (through any level of nesting)
32+
may not define an `impl Type` block unless the `Type` is also nested inside
33+
the same function or closure.
34+
- An item nested inside a function or closure (through any level of nesting)
35+
may not define an `impl Trait for Type` unless either the `Trait` or the
36+
`Type` is also nested inside the same function or closure.
3637

3738
Rust 2015, 2018, and 2021 continue to permit this, but will produce a
3839
warn-by-default lint.

0 commit comments

Comments
 (0)