non_local_defs: improve main without a trait note
This commit is contained in:
parent
d3dfe14b53
commit
ab23fd8dea
@ -548,7 +548,7 @@ lint_non_local_definitions_impl = non-local `impl` definition, `impl` blocks sho
|
||||
[one] `{$body_name}`
|
||||
*[other] `{$body_name}` and up {$depth} bodies
|
||||
}
|
||||
.without_trait = methods and assoc const are still usable outside the current expression, only `impl Local` and `impl dyn Local` are local and only if the `Local` type is at the same nesting as the `impl` block
|
||||
.without_trait = 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`
|
||||
.with_trait = 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`
|
||||
.bounds = `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
|
||||
.exception = items in an anonymous const item (`const _: () = {"{"} ... {"}"}`) are treated as in the same scope as the anonymous const's declaration
|
||||
|
@ -56,7 +56,7 @@ warning: non-local `impl` definition, `impl` blocks should be written at the sam
|
||||
LL | impl Test {
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: methods and assoc const are still usable outside the current expression, only `impl Local` and `impl dyn Local` are local and only if the `Local` type is at the same nesting as the `impl` block
|
||||
= 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`
|
||||
help: move this `impl` block outside of the current function `main`
|
||||
--> $DIR/consts.rs:43:5
|
||||
|
|
||||
@ -73,7 +73,7 @@ warning: non-local `impl` definition, `impl` blocks should be written at the sam
|
||||
LL | impl Test {
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: methods and assoc const are still usable outside the current expression, only `impl Local` and `impl dyn Local` are local and only if the `Local` type is at the same nesting as the `impl` block
|
||||
= 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`
|
||||
help: move this `impl` block outside of the current inline constant `<unnameable>` and up 2 bodies
|
||||
--> $DIR/consts.rs:50:9
|
||||
|
|
||||
@ -90,7 +90,7 @@ warning: non-local `impl` definition, `impl` blocks should be written at the sam
|
||||
LL | impl Test {
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: methods and assoc const are still usable outside the current expression, only `impl Local` and `impl dyn Local` are local and only if the `Local` type is at the same nesting as the `impl` block
|
||||
= 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`
|
||||
help: move this `impl` block outside of the current constant `_` and up 2 bodies
|
||||
--> $DIR/consts.rs:59:9
|
||||
|
|
||||
|
@ -4,7 +4,7 @@ warning: non-local `impl` definition, `impl` blocks should be written at the sam
|
||||
LL | impl Test {
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: methods and assoc const are still usable outside the current expression, only `impl Local` and `impl dyn Local` are local and only if the `Local` type is at the same nesting as the `impl` block
|
||||
= 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`
|
||||
help: move this `impl` block outside of the current function `main`
|
||||
--> $DIR/exhaustive.rs:10:5
|
||||
|
|
||||
@ -42,7 +42,7 @@ warning: non-local `impl` definition, `impl` blocks should be written at the sam
|
||||
LL | impl dyn Trait {}
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: methods and assoc const are still usable outside the current expression, only `impl Local` and `impl dyn Local` are local and only if the `Local` type is at the same nesting as the `impl` block
|
||||
= 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`
|
||||
help: move this `impl` block outside of the current function `main`
|
||||
--> $DIR/exhaustive.rs:22:5
|
||||
|
|
||||
@ -313,7 +313,7 @@ warning: non-local `impl` definition, `impl` blocks should be written at the sam
|
||||
LL | impl InsideMain {
|
||||
| ^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: methods and assoc const are still usable outside the current expression, only `impl Local` and `impl dyn Local` are local and only if the `Local` type is at the same nesting as the `impl` block
|
||||
= 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`
|
||||
help: move this `impl` block outside of the current function `inside_inside` and up 2 bodies
|
||||
--> $DIR/exhaustive.rs:79:9
|
||||
|
|
||||
|
@ -35,7 +35,7 @@ warning: non-local `impl` definition, `impl` blocks should be written at the sam
|
||||
LL | impl Test {
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: methods and assoc const are still usable outside the current expression, only `impl Local` and `impl dyn Local` are local and only if the `Local` type is at the same nesting as the `impl` block
|
||||
= 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`
|
||||
help: move this `impl` block outside of the current constant expression `<unnameable>` and up 2 bodies
|
||||
--> $DIR/weird-exprs.rs:25:9
|
||||
|
|
||||
|
Loading…
x
Reference in New Issue
Block a user