rust/tests/ui/lint/non-local-defs/generics.stderr

166 lines
8.8 KiB
Plaintext

warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
--> $DIR/generics.rs:11:5
|
LL | impl<T: Local> Global for Vec<T> { }
| ^^^^^^^^^^^^^^^------^^^^^---^^^
| | |
| | `Vec` is not local
| `Global` is not local
|
= 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`
help: move the `impl` block outside of this function `main`
--> $DIR/generics.rs:8:1
|
LL | fn main() {
| ^^^^^^^^^
LL | trait Local {};
| ----------- may need to be moved as well
= 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>
note: the lint level is defined here
--> $DIR/generics.rs:4:9
|
LL | #![warn(non_local_definitions)]
| ^^^^^^^^^^^^^^^^^^^^^
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
--> $DIR/generics.rs:22:5
|
LL | impl Uto7 for Test where Local: std::any::Any {}
| ^^^^^----^^^^^----
| | |
| | `Test` is not local
| `Uto7` is not local
|
= 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`
help: move the `impl` block outside of this function `bad`
--> $DIR/generics.rs:20:1
|
LL | fn bad() {
| ^^^^^^^^
LL | struct Local;
| ------------ may need to be moved as well
= 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>
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
--> $DIR/generics.rs:25:5
|
LL | fn bad() {
| -------- move the `impl` block outside of this function `bad`
...
LL | impl<T> Uto8 for T {}
| ^^^^^^^^----^^^^^-
| | |
| | `T` is not local
| `Uto8` is not local
|
= 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`
= 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>
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
--> $DIR/generics.rs:34:5
|
LL | impl Default for UwU<OwO> {
| ^^^^^-------^^^^^---^^^^^
| | |
| | `UwU` is not local
| `Default` is not local
|
= 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`
help: move the `impl` block outside of this function `fun`
--> $DIR/generics.rs:31:1
|
LL | fn fun() {
| ^^^^^^^^
LL | #[derive(Debug)]
LL | struct OwO;
| ---------- may need to be moved as well
= 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>
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
--> $DIR/generics.rs:45:5
|
LL | impl AsRef<Cat> for () {
| ^^^^^-----^^^^^^^^^^--
| | |
| | `()` is not local
| `AsRef` is not local
|
= 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`
help: move the `impl` block outside of this function `meow`
--> $DIR/generics.rs:42:1
|
LL | fn meow() {
| ^^^^^^^^^
LL | #[derive(Debug)]
LL | struct Cat;
| ---------- may need to be moved as well
= 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>
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
--> $DIR/generics.rs:56:5
|
LL | impl PartialEq<B> for G {
| ^^^^^---------^^^^^^^^-
| | |
| | `G` is not local
| `PartialEq` is not local
|
= 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`
help: move the `impl` block outside of this function `fun2`
--> $DIR/generics.rs:53:1
|
LL | fn fun2() {
| ^^^^^^^^^
LL | #[derive(Debug, Default)]
LL | struct B;
| -------- may need to be moved as well
= 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>
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
--> $DIR/generics.rs:71:5
|
LL | impl From<Wrap<Wrap<Lion>>> for () {
| ^^^^^----^^^^^^^^^^^^^^^^^^^^^^^--
| | |
| `From` is not local `()` is not local
|
= 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`
help: move the `impl` block outside of this function `rawr`
--> $DIR/generics.rs:68:1
|
LL | fn rawr() {
| ^^^^^^^^^
LL | struct Lion;
| ----------- may need to be moved as well
= 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>
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
--> $DIR/generics.rs:78:5
|
LL | impl From<()> for Wrap<Lion> {
| ^^^^^----^^^^^^^^^----^^^^^^
| | |
| | `Wrap` is not local
| `From` is not local
|
= 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`
help: move the `impl` block outside of this function `rawr`
--> $DIR/generics.rs:68:1
|
LL | fn rawr() {
| ^^^^^^^^^
LL | struct Lion;
| ----------- may need to be moved as well
= 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>
warning: 8 warnings emitted