2024-05-15 07:08:28 -05:00
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
2024-06-27 01:05:07 -05:00
--> $DIR/suggest-moving-inner.rs:14:5
2024-05-15 07:08:28 -05:00
|
LL | impl<T> Trait<InsideMain> for &Vec<below::Type<(InsideMain, T)>>
2024-05-15 12:13:02 -05:00
| ^^^^^^^^-----^^^^^^^^^^^^^^^^^----------------------------------
| | |
| | `&'_ Vec<below::Type<(InsideMain, T)>>` is not local
| `Trait` is not local
2024-05-15 07:08:28 -05:00
|
= 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
= 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`
2024-05-18 08:07:28 -05:00
help: move the `impl` block outside of this function `main`
2024-06-27 01:05:07 -05:00
--> $DIR/suggest-moving-inner.rs:7:1
2024-05-15 07:08:28 -05:00
|
2024-05-18 08:07:28 -05:00
LL | fn main() {
| ^^^^^^^^^
LL | mod below {
LL | pub struct Type<T>(T);
| ------------------ may need to be moved as well
LL | }
LL | struct InsideMain;
| ----------------- may need to be moved as well
LL | trait HasFoo {}
| ------------ may need to be moved as well
2024-05-15 07:08:28 -05:00
= 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>
2024-06-27 01:05:07 -05:00
note: the lint level is defined here
--> $DIR/suggest-moving-inner.rs:3:9
|
LL | #![warn(non_local_definitions)]
| ^^^^^^^^^^^^^^^^^^^^^
2024-05-15 07:08:28 -05:00
warning: 1 warning emitted