mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-30 02:33:55 +00:00
45 lines
2.0 KiB
Plaintext
45 lines
2.0 KiB
Plaintext
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
|
--> $DIR/generics.rs:9:5
|
|
|
|
|
LL | fn main() {
|
|
| --------- move the `impl` block outside of this function `main`
|
|
...
|
|
LL | impl<T: Local> Global for Vec<T> { }
|
|
| ^^^^^^^^^^^^^^^------^^^^^---^^^
|
|
| | |
|
|
| | `Vec` is not local
|
|
| `Global` 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: `#[warn(non_local_definitions)]` on by default
|
|
|
|
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
|
--> $DIR/generics.rs:20:5
|
|
|
|
|
LL | fn bad() {
|
|
| -------- move the `impl` block outside of this function `bad`
|
|
LL | struct Local;
|
|
LL | impl Uto7 for Test where Local: std::any::Any {}
|
|
| ^^^^^----^^^^^----
|
|
| | |
|
|
| | `Test` is not local
|
|
| `Uto7` 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`
|
|
|
|
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
|
--> $DIR/generics.rs:23:5
|
|
|
|
|
LL | fn bad() {
|
|
| -------- move the `impl` block outside of this function `bad`
|
|
...
|
|
LL | impl<T> Uto8 for T {}
|
|
| ^^^^^^^^----^^^^^^
|
|
| |
|
|
| `Uto8` 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`
|
|
|
|
warning: 3 warnings emitted
|
|
|