non_local_defs: use span of the impl def and not the impl block

This commit is contained in:
Urgau 2024-05-14 12:54:26 +02:00
parent de1c122950
commit 26b873d030
9 changed files with 79 additions and 180 deletions

View File

@ -219,7 +219,7 @@ impl<'tcx> LateLintPass<'tcx> for NonLocalDefinitions {
cx.emit_span_lint(
NON_LOCAL_DEFINITIONS,
item.span,
item.span.shrink_to_lo().to(impl_.self_ty.span),
NonLocalDefinitionsDiag::Impl {
depth: self.body_depth,
body_kind_descr: cx.tcx.def_kind_descr(parent_def_kind, parent),

View File

@ -5,7 +5,7 @@ LL | const Z: () = {
| - help: use a const-anon item to suppress this lint: `_`
...
LL | impl Uto for &Test {}
| ^^^^^^^^^^^^^^^^^^^^^
| ^^^^^^^^^^^^^^^^^^
|
= help: move this `impl` block outside the of the current constant `Z`
= 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
@ -18,7 +18,7 @@ warning: non-local `impl` definition, `impl` blocks should be written at the sam
--> $DIR/consts.rs:24:5
|
LL | impl Uto2 for Test {}
| ^^^^^^^^^^^^^^^^^^^^^
| ^^^^^^^^^^^^^^^^^^
|
= help: move this `impl` block outside the of the current static `A`
= 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
@ -30,7 +30,7 @@ warning: non-local `impl` definition, `impl` blocks should be written at the sam
--> $DIR/consts.rs:32:5
|
LL | impl Uto3 for Test {}
| ^^^^^^^^^^^^^^^^^^^^^
| ^^^^^^^^^^^^^^^^^^
|
= help: move this `impl` block outside the of the current constant `B`
= 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
@ -41,11 +41,8 @@ LL | impl Uto3 for Test {}
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
--> $DIR/consts.rs:43:5
|
LL | / impl Test {
LL | |
LL | | fn foo() {}
LL | | }
| |_____^
LL | impl Test {
| ^^^^^^^^^
|
= help: move this `impl` block outside the of the current function `main`
= 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
@ -54,11 +51,8 @@ LL | | }
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
--> $DIR/consts.rs:50:9
|
LL | / impl Test {
LL | |
LL | | fn hoo() {}
LL | | }
| |_________^
LL | impl Test {
| ^^^^^^^^^
|
= help: move this `impl` block outside the of the current inline constant `<unnameable>` and up 2 bodies
= 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
@ -67,11 +61,8 @@ LL | | }
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
--> $DIR/consts.rs:59:9
|
LL | / impl Test {
LL | |
LL | | fn foo2() {}
LL | | }
| |_________^
LL | impl Test {
| ^^^^^^^^^
|
= help: move this `impl` block outside the of the current constant `_` and up 2 bodies
= 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
@ -82,7 +73,7 @@ warning: non-local `impl` definition, `impl` blocks should be written at the sam
--> $DIR/consts.rs:72:9
|
LL | impl Uto9 for Test {}
| ^^^^^^^^^^^^^^^^^^^^^
| ^^^^^^^^^^^^^^^^^^
|
= help: move this `impl` block outside the of the current closure `<unnameable>` and up 2 bodies
= 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
@ -93,7 +84,7 @@ warning: non-local `impl` definition, `impl` blocks should be written at the sam
--> $DIR/consts.rs:79:9
|
LL | impl Uto10 for Test {}
| ^^^^^^^^^^^^^^^^^^^^^^
| ^^^^^^^^^^^^^^^^^^^
|
= help: move this `impl` block outside the of the current constant expression `<unnameable>` and up 2 bodies
= 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

View File

@ -1,13 +1,8 @@
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
--> $DIR/exhaustive-trait.rs:7:5
|
LL | / impl PartialEq<()> for Dog {
LL | |
LL | | fn eq(&self, _: &()) -> bool {
LL | | todo!()
LL | | }
LL | | }
| |_____^
LL | impl PartialEq<()> for Dog {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: move this `impl` block outside the of the current function `main`
= 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
@ -18,13 +13,8 @@ LL | | }
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
--> $DIR/exhaustive-trait.rs:14:5
|
LL | / impl PartialEq<()> for &Dog {
LL | |
LL | | fn eq(&self, _: &()) -> bool {
LL | | todo!()
LL | | }
LL | | }
| |_____^
LL | impl PartialEq<()> for &Dog {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: move this `impl` block outside the of the current function `main`
= 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
@ -34,13 +24,8 @@ LL | | }
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
--> $DIR/exhaustive-trait.rs:21:5
|
LL | / impl PartialEq<Dog> for () {
LL | |
LL | | fn eq(&self, _: &Dog) -> bool {
LL | | todo!()
LL | | }
LL | | }
| |_____^
LL | impl PartialEq<Dog> for () {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: move this `impl` block outside the of the current function `main`
= 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
@ -50,13 +35,8 @@ LL | | }
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
--> $DIR/exhaustive-trait.rs:28:5
|
LL | / impl PartialEq<&Dog> for () {
LL | |
LL | | fn eq(&self, _: &&Dog) -> bool {
LL | | todo!()
LL | | }
LL | | }
| |_____^
LL | impl PartialEq<&Dog> for () {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: move this `impl` block outside the of the current function `main`
= 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
@ -66,13 +46,8 @@ LL | | }
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
--> $DIR/exhaustive-trait.rs:35:5
|
LL | / impl PartialEq<Dog> for &Dog {
LL | |
LL | | fn eq(&self, _: &Dog) -> bool {
LL | | todo!()
LL | | }
LL | | }
| |_____^
LL | impl PartialEq<Dog> for &Dog {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: move this `impl` block outside the of the current function `main`
= 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
@ -82,13 +57,8 @@ LL | | }
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
--> $DIR/exhaustive-trait.rs:42:5
|
LL | / impl PartialEq<&Dog> for &Dog {
LL | |
LL | | fn eq(&self, _: &&Dog) -> bool {
LL | | todo!()
LL | | }
LL | | }
| |_____^
LL | impl PartialEq<&Dog> for &Dog {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: move this `impl` block outside the of the current function `main`
= 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

View File

@ -1,11 +1,8 @@
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
--> $DIR/exhaustive.rs:10:5
|
LL | / impl Test {
LL | |
LL | | fn foo() {}
LL | | }
| |_____^
LL | impl Test {
| ^^^^^^^^^
|
= help: move this `impl` block outside the of the current function `main`
= 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
@ -15,13 +12,8 @@ LL | | }
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
--> $DIR/exhaustive.rs:15:5
|
LL | / impl Display for Test {
LL | |
LL | | fn fmt(&self, _f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
LL | | todo!()
LL | | }
LL | | }
| |_____^
LL | impl Display for Test {
| ^^^^^^^^^^^^^^^^^^^^^
|
= help: move this `impl` block outside the of the current function `main`
= 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
@ -32,7 +24,7 @@ warning: non-local `impl` definition, `impl` blocks should be written at the sam
--> $DIR/exhaustive.rs:22:5
|
LL | impl dyn Trait {}
| ^^^^^^^^^^^^^^^^^
| ^^^^^^^^^^^^^^
|
= help: move this `impl` block outside the of the current function `main`
= 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
@ -42,7 +34,7 @@ warning: non-local `impl` definition, `impl` blocks should be written at the sam
--> $DIR/exhaustive.rs:25:5
|
LL | impl<T: Trait> Trait for Vec<T> { }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: move this `impl` block outside the of the current function `main`
= 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
@ -53,7 +45,7 @@ warning: non-local `impl` definition, `impl` blocks should be written at the sam
--> $DIR/exhaustive.rs:28:5
|
LL | impl Trait for &dyn Trait {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: move this `impl` block outside the of the current function `main`
= 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
@ -64,7 +56,7 @@ warning: non-local `impl` definition, `impl` blocks should be written at the sam
--> $DIR/exhaustive.rs:31:5
|
LL | impl Trait for *mut Test {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: move this `impl` block outside the of the current function `main`
= 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
@ -75,7 +67,7 @@ warning: non-local `impl` definition, `impl` blocks should be written at the sam
--> $DIR/exhaustive.rs:34:5
|
LL | impl Trait for *mut [Test] {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: move this `impl` block outside the of the current function `main`
= 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
@ -86,7 +78,7 @@ warning: non-local `impl` definition, `impl` blocks should be written at the sam
--> $DIR/exhaustive.rs:37:5
|
LL | impl Trait for [Test; 8] {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: move this `impl` block outside the of the current function `main`
= 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
@ -97,7 +89,7 @@ warning: non-local `impl` definition, `impl` blocks should be written at the sam
--> $DIR/exhaustive.rs:40:5
|
LL | impl Trait for (Test,) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^
| ^^^^^^^^^^^^^^^^^^^^^^
|
= help: move this `impl` block outside the of the current function `main`
= 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
@ -108,7 +100,7 @@ warning: non-local `impl` definition, `impl` blocks should be written at the sam
--> $DIR/exhaustive.rs:43:5
|
LL | impl Trait for fn(Test) -> () {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: move this `impl` block outside the of the current function `main`
= 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
@ -119,7 +111,7 @@ warning: non-local `impl` definition, `impl` blocks should be written at the sam
--> $DIR/exhaustive.rs:46:5
|
LL | impl Trait for fn() -> Test {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: move this `impl` block outside the of the current function `main`
= 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
@ -130,7 +122,7 @@ warning: non-local `impl` definition, `impl` blocks should be written at the sam
--> $DIR/exhaustive.rs:50:9
|
LL | impl Trait for Test {}
| ^^^^^^^^^^^^^^^^^^^^^^
| ^^^^^^^^^^^^^^^^^^^
|
= help: move this `impl` block outside the of the current closure `<unnameable>` and up 2 bodies
= 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
@ -141,7 +133,7 @@ warning: non-local `impl` definition, `impl` blocks should be written at the sam
--> $DIR/exhaustive.rs:58:5
|
LL | impl Trait for *mut InsideMain {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: move this `impl` block outside the of the current function `main`
= 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
@ -152,7 +144,7 @@ warning: non-local `impl` definition, `impl` blocks should be written at the sam
--> $DIR/exhaustive.rs:60:5
|
LL | impl Trait for *mut [InsideMain] {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: move this `impl` block outside the of the current function `main`
= 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
@ -163,7 +155,7 @@ warning: non-local `impl` definition, `impl` blocks should be written at the sam
--> $DIR/exhaustive.rs:62:5
|
LL | impl Trait for [InsideMain; 8] {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: move this `impl` block outside the of the current function `main`
= 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
@ -174,7 +166,7 @@ warning: non-local `impl` definition, `impl` blocks should be written at the sam
--> $DIR/exhaustive.rs:64:5
|
LL | impl Trait for (InsideMain,) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: move this `impl` block outside the of the current function `main`
= 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
@ -185,7 +177,7 @@ warning: non-local `impl` definition, `impl` blocks should be written at the sam
--> $DIR/exhaustive.rs:66:5
|
LL | impl Trait for fn(InsideMain) -> () {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: move this `impl` block outside the of the current function `main`
= 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
@ -196,7 +188,7 @@ warning: non-local `impl` definition, `impl` blocks should be written at the sam
--> $DIR/exhaustive.rs:68:5
|
LL | impl Trait for fn() -> InsideMain {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: move this `impl` block outside the of the current function `main`
= 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
@ -206,13 +198,8 @@ LL | impl Trait for fn() -> InsideMain {}
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
--> $DIR/exhaustive.rs:72:9
|
LL | / impl Display for InsideMain {
LL | |
LL | | fn fmt(&self, _f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
LL | | todo!()
LL | | }
LL | | }
| |_________^
LL | impl Display for InsideMain {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: move this `impl` block outside the of the current function `inside_inside` and up 2 bodies
= 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
@ -222,11 +209,8 @@ LL | | }
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
--> $DIR/exhaustive.rs:79:9
|
LL | / impl InsideMain {
LL | |
LL | | fn bar() {}
LL | | }
| |_________^
LL | impl InsideMain {
| ^^^^^^^^^^^^^^^
|
= help: move this `impl` block outside the of the current function `inside_inside` and up 2 bodies
= 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

View File

@ -1,13 +1,8 @@
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
--> $DIR/from-local-for-global.rs:8:5
|
LL | / impl From<Cat> for () {
LL | |
LL | | fn from(_: Cat) -> () {
LL | | todo!()
LL | | }
LL | | }
| |_____^
LL | impl From<Cat> for () {
| ^^^^^^^^^^^^^^^^^^^^^
|
= help: move this `impl` block outside the of the current function `main`
= 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
@ -18,13 +13,8 @@ LL | | }
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
--> $DIR/from-local-for-global.rs:18:5
|
LL | / impl From<Wrap<Wrap<Elephant>>> for () {
LL | |
LL | | fn from(_: Wrap<Wrap<Elephant>>) -> Self {
LL | | todo!()
LL | | }
LL | | }
| |_____^
LL | impl From<Wrap<Wrap<Elephant>>> for () {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: move this `impl` block outside the of the current function `main`
= 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
@ -35,7 +25,7 @@ warning: non-local `impl` definition, `impl` blocks should be written at the sam
--> $DIR/from-local-for-global.rs:32:5
|
LL | impl StillNonLocal for &Foo {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: move this `impl` block outside the of the current function `only_global`
= 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
@ -45,13 +35,8 @@ LL | impl StillNonLocal for &Foo {}
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
--> $DIR/from-local-for-global.rs:40:5
|
LL | / impl From<Local1> for GlobalSameFunction {
LL | |
LL | | fn from(x: Local1) -> GlobalSameFunction {
LL | | x.0
LL | | }
LL | | }
| |_____^
LL | impl From<Local1> for GlobalSameFunction {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: move this `impl` block outside the of the current function `same_function`
= 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
@ -61,13 +46,8 @@ LL | | }
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
--> $DIR/from-local-for-global.rs:48:5
|
LL | / impl From<Local2> for GlobalSameFunction {
LL | |
LL | | fn from(x: Local2) -> GlobalSameFunction {
LL | | x.0
LL | | }
LL | | }
| |_____^
LL | impl From<Local2> for GlobalSameFunction {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: move this `impl` block outside the of the current function `same_function`
= 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

View File

@ -2,7 +2,7 @@ warning: non-local `impl` definition, `impl` blocks should be written at the sam
--> $DIR/generics.rs:9:5
|
LL | impl<T: Local> Global for Vec<T> { }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: move this `impl` block outside the of the current function `main`
= 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
@ -14,7 +14,7 @@ warning: non-local `impl` definition, `impl` blocks should be written at the sam
--> $DIR/generics.rs:20:5
|
LL | impl Uto7 for Test where Local: std::any::Any {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| ^^^^^^^^^^^^^^^^^^
|
= help: move this `impl` block outside the of the current function `bad`
= 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
@ -25,7 +25,7 @@ warning: non-local `impl` definition, `impl` blocks should be written at the sam
--> $DIR/generics.rs:23:5
|
LL | impl<T> Uto8 for T {}
| ^^^^^^^^^^^^^^^^^^^^^
| ^^^^^^^^^^^^^^^^^^
|
= help: move this `impl` block outside the of the current function `bad`
= 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
@ -35,13 +35,8 @@ LL | impl<T> Uto8 for T {}
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
--> $DIR/generics.rs:32:5
|
LL | / impl Default for UwU<OwO> {
LL | |
LL | | fn default() -> Self {
LL | | UwU(OwO)
LL | | }
LL | | }
| |_____^
LL | impl Default for UwU<OwO> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: move this `impl` block outside the of the current function `fun`
= 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
@ -51,11 +46,8 @@ LL | | }
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
--> $DIR/generics.rs:43:5
|
LL | / impl AsRef<Cat> for () {
LL | |
LL | | fn as_ref(&self) -> &Cat { &Cat }
LL | | }
| |_____^
LL | impl AsRef<Cat> for () {
| ^^^^^^^^^^^^^^^^^^^^^^
|
= help: move this `impl` block outside the of the current function `meow`
= 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
@ -65,13 +57,8 @@ LL | | }
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
--> $DIR/generics.rs:54:5
|
LL | / impl PartialEq<B> for G {
LL | |
LL | | fn eq(&self, _: &B) -> bool {
LL | | true
LL | | }
LL | | }
| |_____^
LL | impl PartialEq<B> for G {
| ^^^^^^^^^^^^^^^^^^^^^^^
|
= help: move this `impl` block outside the of the current function `fun2`
= 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
@ -81,13 +68,8 @@ LL | | }
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
--> $DIR/generics.rs:69:5
|
LL | / impl From<Wrap<Wrap<Lion>>> for () {
LL | |
LL | | fn from(_: Wrap<Wrap<Lion>>) -> Self {
LL | | todo!()
LL | | }
LL | | }
| |_____^
LL | impl From<Wrap<Wrap<Lion>>> for () {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: move this `impl` block outside the of the current function `rawr`
= 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
@ -97,13 +79,8 @@ LL | | }
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
--> $DIR/generics.rs:76:5
|
LL | / impl From<()> for Wrap<Lion> {
LL | |
LL | | fn from(_: ()) -> Self {
LL | | todo!()
LL | | }
LL | | }
| |_____^
LL | impl From<()> for Wrap<Lion> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: move this `impl` block outside the of the current function `rawr`
= 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

View File

@ -2,7 +2,7 @@ warning: non-local `impl` definition, `impl` blocks should be written at the sam
--> $DIR/inside-macro_rules.rs:9:13
|
LL | impl MacroTrait for OutsideStruct {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
LL | m!();
| ---- in this macro invocation

View File

@ -2,7 +2,7 @@ warning: non-local `impl` definition, `impl` blocks should be written at the sam
--> $DIR/trait-solver-overflow-123573.rs:12:5
|
LL | impl Test for &Local {}
| ^^^^^^^^^^^^^^^^^^^^^^^
| ^^^^^^^^^^^^^^^^^^^^
|
= help: move this `impl` block outside the of the current function `main`
= 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

View File

@ -2,7 +2,7 @@ warning: non-local `impl` definition, `impl` blocks should be written at the sam
--> $DIR/weird-exprs.rs:8:5
|
LL | impl Uto for *mut Test {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^
| ^^^^^^^^^^^^^^^^^^^^^^
|
= help: move this `impl` block outside the of the current constant expression `<unnameable>`
= 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
@ -14,7 +14,7 @@ warning: non-local `impl` definition, `impl` blocks should be written at the sam
--> $DIR/weird-exprs.rs:16:9
|
LL | impl Uto for Test {}
| ^^^^^^^^^^^^^^^^^^^^
| ^^^^^^^^^^^^^^^^^
|
= help: move this `impl` block outside the of the current constant expression `<unnameable>`
= 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
@ -24,11 +24,8 @@ LL | impl Uto for Test {}
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
--> $DIR/weird-exprs.rs:25:9
|
LL | / impl Test {
LL | |
LL | | fn bar() {}
LL | | }
| |_________^
LL | impl Test {
| ^^^^^^^^^
|
= help: move this `impl` block outside the of the current constant expression `<unnameable>` and up 2 bodies
= 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
@ -38,7 +35,7 @@ warning: non-local `impl` definition, `impl` blocks should be written at the sam
--> $DIR/weird-exprs.rs:34:9
|
LL | impl Uto for &Test {}
| ^^^^^^^^^^^^^^^^^^^^^
| ^^^^^^^^^^^^^^^^^^
|
= help: move this `impl` block outside the of the current constant expression `<unnameable>` and up 2 bodies
= 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
@ -49,7 +46,7 @@ warning: non-local `impl` definition, `impl` blocks should be written at the sam
--> $DIR/weird-exprs.rs:41:9
|
LL | impl Uto for &(Test,) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^
| ^^^^^^^^^^^^^^^^^^^^^
|
= help: move this `impl` block outside the of the current constant expression `<unnameable>` and up 2 bodies
= 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
@ -60,7 +57,7 @@ warning: non-local `impl` definition, `impl` blocks should be written at the sam
--> $DIR/weird-exprs.rs:48:9
|
LL | impl Uto for &(Test,Test) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: move this `impl` block outside the of the current constant expression `<unnameable>` and up 2 bodies
= 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