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

350 lines
20 KiB
Plaintext

warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
--> $DIR/exhaustive.rs:12:5
|
LL | fn main() {
| --------- move the `impl` block outside of this function `main`
LL | impl Test {
| ^^^^^----
| |
| `Test` is not local
|
= note: methods and associated constants are still usable outside the current expression, only `impl Local` and `impl dyn Local` can ever be private, and only if the type is nested in the same item 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>
note: the lint level is defined here
--> $DIR/exhaustive.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/exhaustive.rs:17:5
|
LL | fn main() {
| --------- move the `impl` block outside of this function `main`
...
LL | impl Display for Test {
| ^^^^^-------^^^^^----
| | |
| | `Test` is not local
| `Display` 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/exhaustive.rs:24:5
|
LL | fn main() {
| --------- move the `impl` block outside of this function `main`
...
LL | impl dyn Trait {}
| ^^^^^^^^^-----
| |
| `Trait` is not local
|
= note: methods and associated constants are still usable outside the current expression, only `impl Local` and `impl dyn Local` can ever be private, and only if the type is nested in the same item 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/exhaustive.rs:27:5
|
LL | fn main() {
| --------- move the `impl` block outside of this function `main`
...
LL | impl<T: Trait> Trait for Vec<T> { }
| ^^^^^^^^^^^^^^^-----^^^^^---^^^
| | |
| | `Vec` is not local
| `Trait` 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/exhaustive.rs:30:5
|
LL | fn main() {
| --------- move the `impl` block outside of this function `main`
...
LL | impl Trait for &dyn Trait {}
| ^^^^^-----^^^^^----------
| | |
| | `&'_ dyn Trait` is not local
| `Trait` 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/exhaustive.rs:33:5
|
LL | fn main() {
| --------- move the `impl` block outside of this function `main`
...
LL | impl Trait for *mut Test {}
| ^^^^^-----^^^^^---------
| | |
| | `*mut Test` is not local
| `Trait` 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/exhaustive.rs:36:5
|
LL | fn main() {
| --------- move the `impl` block outside of this function `main`
...
LL | impl Trait for *mut [Test] {}
| ^^^^^-----^^^^^-----------
| | |
| | `*mut [Test]` is not local
| `Trait` 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/exhaustive.rs:39:5
|
LL | fn main() {
| --------- move the `impl` block outside of this function `main`
...
LL | impl Trait for [Test; 8] {}
| ^^^^^-----^^^^^---------
| | |
| | `[Test; 8]` is not local
| `Trait` 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/exhaustive.rs:42:5
|
LL | fn main() {
| --------- move the `impl` block outside of this function `main`
...
LL | impl Trait for (Test,) {}
| ^^^^^-----^^^^^-------
| | |
| | `(Test,)` is not local
| `Trait` 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/exhaustive.rs:45:5
|
LL | fn main() {
| --------- move the `impl` block outside of this function `main`
...
LL | impl Trait for fn(Test) -> () {}
| ^^^^^-----^^^^^--------------
| | |
| | `fn(: Test) -> ()` is not local
| `Trait` 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/exhaustive.rs:48:5
|
LL | fn main() {
| --------- move the `impl` block outside of this function `main`
...
LL | impl Trait for fn() -> Test {}
| ^^^^^-----^^^^^------------
| | |
| | `fn() -> Test` is not local
| `Trait` 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/exhaustive.rs:52:9
|
LL | let _a = || {
| -- move the `impl` block outside of this closure `<unnameable>` and up 2 bodies
LL | impl Trait for Test {}
| ^^^^^-----^^^^^----
| | |
| | `Test` is not local
| `Trait` 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/exhaustive.rs:60:5
|
LL | impl Trait for *mut InsideMain {}
| ^^^^^-----^^^^^---------------
| | |
| | `*mut InsideMain` is not local
| | help: remove `*mut ` to make the `impl` local
| `Trait` 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/exhaustive.rs:11:1
|
LL | fn main() {
| ^^^^^^^^^
...
LL | struct InsideMain;
| ----------------- 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/exhaustive.rs:62:5
|
LL | impl Trait for *mut [InsideMain] {}
| ^^^^^-----^^^^^-----------------
| | |
| | `*mut [InsideMain]` is not local
| `Trait` 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/exhaustive.rs:11:1
|
LL | fn main() {
| ^^^^^^^^^
...
LL | struct InsideMain;
| ----------------- 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/exhaustive.rs:64:5
|
LL | impl Trait for [InsideMain; 8] {}
| ^^^^^-----^^^^^---------------
| | |
| | `[InsideMain; 8]` is not local
| `Trait` 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/exhaustive.rs:11:1
|
LL | fn main() {
| ^^^^^^^^^
...
LL | struct InsideMain;
| ----------------- 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/exhaustive.rs:66:5
|
LL | impl Trait for (InsideMain,) {}
| ^^^^^-----^^^^^-------------
| | |
| | `(InsideMain,)` is not local
| `Trait` 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/exhaustive.rs:11:1
|
LL | fn main() {
| ^^^^^^^^^
...
LL | struct InsideMain;
| ----------------- 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/exhaustive.rs:68:5
|
LL | impl Trait for fn(InsideMain) -> () {}
| ^^^^^-----^^^^^--------------------
| | |
| | `fn(: InsideMain) -> ()` is not local
| `Trait` 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/exhaustive.rs:11:1
|
LL | fn main() {
| ^^^^^^^^^
...
LL | struct InsideMain;
| ----------------- 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/exhaustive.rs:70:5
|
LL | impl Trait for fn() -> InsideMain {}
| ^^^^^-----^^^^^------------------
| | |
| | `fn() -> InsideMain` is not local
| `Trait` 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/exhaustive.rs:11:1
|
LL | fn main() {
| ^^^^^^^^^
...
LL | struct InsideMain;
| ----------------- 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/exhaustive.rs:74:9
|
LL | fn inside_inside() {
| ------------------ move the `impl` block outside of this function `inside_inside` and up 2 bodies
LL | impl Display for InsideMain {
| ^^^^^-------^^^^^----------
| | |
| | `InsideMain` is not local
| `Display` 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/exhaustive.rs:81:9
|
LL | fn inside_inside() {
| ------------------ move the `impl` block outside of this function `inside_inside` and up 2 bodies
...
LL | impl InsideMain {
| ^^^^^----------
| |
| `InsideMain` is not local
|
= note: methods and associated constants are still usable outside the current expression, only `impl Local` and `impl dyn Local` can ever be private, and only if the type is nested in the same item 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: 20 warnings emitted