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

346 lines
20 KiB
Plaintext

warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
--> $DIR/exhaustive.rs:10: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: `#[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/exhaustive.rs:15: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:22: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:25: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:28: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:31: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:34: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:37: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:40: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:43: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:46: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:50: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:58: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:9: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:60: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:9: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 [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:9: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,) {}
| ^^^^^-----^^^^^-------------
| | |
| | `(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:9: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 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:9: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:9: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:72: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:79: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