|
1 | 1 | warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
2 |
| - --> $DIR/suggest-moving-inner.rs:11:5 |
| 2 | + --> $DIR/suggest-moving-inner.rs:12:5 |
3 | 3 | |
|
4 |
| -LL | impl Trait<InsideMain> for &Vec<below::Type<InsideMain>> {} |
5 |
| - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 4 | +LL | impl<T> Trait<InsideMain> for &Vec<below::Type<(InsideMain, T)>> |
| 5 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
6 | 6 | |
|
7 | 7 | = note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type
|
8 | 8 | = 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`
|
9 | 9 | help: move this `impl` block outside of the current function `main`
|
10 |
| - --> $DIR/suggest-moving-inner.rs:11:5 |
| 10 | + --> $DIR/suggest-moving-inner.rs:12:5 |
11 | 11 | |
|
12 |
| -LL | impl Trait<InsideMain> for &Vec<below::Type<InsideMain>> {} |
13 |
| - | ^^^^^^^^^^^----------^^^^^^^^^^^-----------^----------^^^^^ |
14 |
| - | | | | |
15 |
| - | | | may need to be moved as well |
16 |
| - | | may need to be moved as well |
17 |
| - | may need to be moved as well |
| 12 | +LL | impl<T> Trait<InsideMain> for &Vec<below::Type<(InsideMain, T)>> |
| 13 | + | ^ ---------- ----------- ---------- may need to be moved as well |
| 14 | + | | | | |
| 15 | + | | | may need to be moved as well |
| 16 | + | _____| may need to be moved as well |
| 17 | + | | |
| 18 | +LL | | |
| 19 | +LL | | where |
| 20 | +LL | | T: HasFoo |
| 21 | + | | ------ may need to be moved as well |
| 22 | +LL | | {} |
| 23 | + | |______^ |
18 | 24 | = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
19 | 25 | = note: `#[warn(non_local_definitions)]` on by default
|
20 | 26 |
|
|
0 commit comments