-
Notifications
You must be signed in to change notification settings - Fork 12.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tracking Issue for RFC 3373: Avoid non-local definitions in functions #120363
Comments
Implement RFC 3373: Avoid non-local definitions in functions This PR implements [RFC 3373: Avoid non-local definitions in functions](rust-lang#120363).
…leLapkin Implement RFC 3373: Avoid non-local definitions in functions This PR implements [RFC 3373: Avoid non-local definitions in functions](rust-lang#120363).
Fixes a non_local_definitions warning in the derived code. warning: non-local `impl` definition, they should be avoided as they go against expectation --> tests/test_derive.rs:5:28 | 5 | #[derive(PartialEq, Debug, Serialize, Deserialize)] | ^^^^^^^^^ | = help: move this `impl` block outside the of the current constant `_IMPL_MINISERIALIZE_FOR_Tag` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <rust-lang/rust#120363> = note: the derive macro `Serialize` may come from an old version of the `mini_internal` crate, try updating your dependency with `cargo update -p mini_internal` = note: `#[warn(non_local_definitions)]` on by default = note: this warning originates in the derive macro `Serialize` (in Nightly builds, run with -Z macro-backtrace for more info)
Fixes warning about non_local_definitions. warning: non-local `impl` definition, they should be avoided as they go against expectation --> src/de/impls.rs:21:9 | 21 | / impl Visitor for Place<()> { 22 | | fn null(&mut self) -> Result<()> { 23 | | self.out = Some(()); 24 | | Ok(()) 25 | | } 26 | | } | |_________^ | = help: move this `impl` block outside the of the current associated function `begin` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <rust-lang/rust#120363> = note: `#[warn(non_local_definitions)]` on by default warning: non-local `impl` definition, they should be avoided as they go against expectation --> src/de/impls.rs:33:9 | 33 | / impl Visitor for Place<bool> { 34 | | fn boolean(&mut self, b: bool) -> Result<()> { 35 | | self.out = Some(b); 36 | | Ok(()) 37 | | } 38 | | } | |_________^ | = help: move this `impl` block outside the of the current associated function `begin` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <rust-lang/rust#120363> warning: non-local `impl` definition, they should be avoided as they go against expectation --> src/de/impls.rs:45:9 | 45 | / impl Visitor for Place<String> { 46 | | fn string(&mut self, s: &str) -> Result<()> { 47 | | self.out = Some(s.to_owned()); 48 | | Ok(()) 49 | | } 50 | | } | |_________^ | = help: move this `impl` block outside the of the current associated function `begin` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <rust-lang/rust#120363> warning: non-local `impl` definition, they should be avoided as they go against expectation --> src/de/impls.rs:59:17 | 59 | / impl Visitor for Place<$ty> { 60 | | fn negative(&mut self, n: i64) -> Result<()> { 61 | | if n >= $ty::min_value() as i64 { 62 | | self.out = Some(n as $ty); ... | 76 | | } 77 | | } | |_________________^ ... 83 | signed!(i8); | ----------- in this macro invocation | = help: move this `impl` block outside the of the current associated function `begin` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <rust-lang/rust#120363> = note: this warning originates in the macro `signed` (in Nightly builds, run with -Z macro-backtrace for more info) warning: non-local `impl` definition, they should be avoided as they go against expectation --> src/de/impls.rs:59:17 | 59 | / impl Visitor for Place<$ty> { 60 | | fn negative(&mut self, n: i64) -> Result<()> { 61 | | if n >= $ty::min_value() as i64 { 62 | | self.out = Some(n as $ty); ... | 76 | | } 77 | | } | |_________________^ ... 84 | signed!(i16); | ------------ in this macro invocation | = help: move this `impl` block outside the of the current associated function `begin` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <rust-lang/rust#120363> = note: this warning originates in the macro `signed` (in Nightly builds, run with -Z macro-backtrace for more info) warning: non-local `impl` definition, they should be avoided as they go against expectation --> src/de/impls.rs:59:17 | 59 | / impl Visitor for Place<$ty> { 60 | | fn negative(&mut self, n: i64) -> Result<()> { 61 | | if n >= $ty::min_value() as i64 { 62 | | self.out = Some(n as $ty); ... | 76 | | } 77 | | } | |_________________^ ... 85 | signed!(i32); | ------------ in this macro invocation | = help: move this `impl` block outside the of the current associated function `begin` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <rust-lang/rust#120363> = note: this warning originates in the macro `signed` (in Nightly builds, run with -Z macro-backtrace for more info) warning: non-local `impl` definition, they should be avoided as they go against expectation --> src/de/impls.rs:59:17 | 59 | / impl Visitor for Place<$ty> { 60 | | fn negative(&mut self, n: i64) -> Result<()> { 61 | | if n >= $ty::min_value() as i64 { 62 | | self.out = Some(n as $ty); ... | 76 | | } 77 | | } | |_________________^ ... 86 | signed!(i64); | ------------ in this macro invocation | = help: move this `impl` block outside the of the current associated function `begin` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <rust-lang/rust#120363> = note: this warning originates in the macro `signed` (in Nightly builds, run with -Z macro-backtrace for more info) warning: non-local `impl` definition, they should be avoided as they go against expectation --> src/de/impls.rs:59:17 | 59 | / impl Visitor for Place<$ty> { 60 | | fn negative(&mut self, n: i64) -> Result<()> { 61 | | if n >= $ty::min_value() as i64 { 62 | | self.out = Some(n as $ty); ... | 76 | | } 77 | | } | |_________________^ ... 87 | signed!(isize); | -------------- in this macro invocation | = help: move this `impl` block outside the of the current associated function `begin` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <rust-lang/rust#120363> = note: this warning originates in the macro `signed` (in Nightly builds, run with -Z macro-backtrace for more info) warning: non-local `impl` definition, they should be avoided as they go against expectation --> src/de/impls.rs:93:17 | 93 | / impl Visitor for Place<$ty> { 94 | | fn nonnegative(&mut self, n: u64) -> Result<()> { 95 | | if n <= $ty::max_value() as u64 { 96 | | self.out = Some(n as $ty); ... | 101 | | } 102 | | } | |_________________^ ... 108 | unsigned!(u8); | ------------- in this macro invocation | = help: move this `impl` block outside the of the current associated function `begin` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <rust-lang/rust#120363> = note: this warning originates in the macro `unsigned` (in Nightly builds, run with -Z macro-backtrace for more info) warning: non-local `impl` definition, they should be avoided as they go against expectation --> src/de/impls.rs:93:17 | 93 | / impl Visitor for Place<$ty> { 94 | | fn nonnegative(&mut self, n: u64) -> Result<()> { 95 | | if n <= $ty::max_value() as u64 { 96 | | self.out = Some(n as $ty); ... | 101 | | } 102 | | } | |_________________^ ... 109 | unsigned!(u16); | -------------- in this macro invocation | = help: move this `impl` block outside the of the current associated function `begin` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <rust-lang/rust#120363> = note: this warning originates in the macro `unsigned` (in Nightly builds, run with -Z macro-backtrace for more info) warning: non-local `impl` definition, they should be avoided as they go against expectation --> src/de/impls.rs:93:17 | 93 | / impl Visitor for Place<$ty> { 94 | | fn nonnegative(&mut self, n: u64) -> Result<()> { 95 | | if n <= $ty::max_value() as u64 { 96 | | self.out = Some(n as $ty); ... | 101 | | } 102 | | } | |_________________^ ... 110 | unsigned!(u32); | -------------- in this macro invocation | = help: move this `impl` block outside the of the current associated function `begin` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <rust-lang/rust#120363> = note: this warning originates in the macro `unsigned` (in Nightly builds, run with -Z macro-backtrace for more info) warning: non-local `impl` definition, they should be avoided as they go against expectation --> src/de/impls.rs:93:17 | 93 | / impl Visitor for Place<$ty> { 94 | | fn nonnegative(&mut self, n: u64) -> Result<()> { 95 | | if n <= $ty::max_value() as u64 { 96 | | self.out = Some(n as $ty); ... | 101 | | } 102 | | } | |_________________^ ... 111 | unsigned!(u64); | -------------- in this macro invocation | = help: move this `impl` block outside the of the current associated function `begin` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <rust-lang/rust#120363> = note: this warning originates in the macro `unsigned` (in Nightly builds, run with -Z macro-backtrace for more info) warning: non-local `impl` definition, they should be avoided as they go against expectation --> src/de/impls.rs:93:17 | 93 | / impl Visitor for Place<$ty> { 94 | | fn nonnegative(&mut self, n: u64) -> Result<()> { 95 | | if n <= $ty::max_value() as u64 { 96 | | self.out = Some(n as $ty); ... | 101 | | } 102 | | } | |_________________^ ... 112 | unsigned!(usize); | ---------------- in this macro invocation | = help: move this `impl` block outside the of the current associated function `begin` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <rust-lang/rust#120363> = note: this warning originates in the macro `unsigned` (in Nightly builds, run with -Z macro-backtrace for more info) warning: non-local `impl` definition, they should be avoided as they go against expectation --> src/de/impls.rs:118:17 | 118 | / impl Visitor for Place<$ty> { 119 | | fn negative(&mut self, n: i64) -> Result<()> { 120 | | self.out = Some(n as $ty); 121 | | Ok(()) ... | 132 | | } 133 | | } | |_________________^ ... 139 | float!(f32); | ----------- in this macro invocation | = help: move this `impl` block outside the of the current associated function `begin` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <rust-lang/rust#120363> = note: this warning originates in the macro `float` (in Nightly builds, run with -Z macro-backtrace for more info) warning: non-local `impl` definition, they should be avoided as they go against expectation --> src/de/impls.rs:118:17 | 118 | / impl Visitor for Place<$ty> { 119 | | fn negative(&mut self, n: i64) -> Result<()> { 120 | | self.out = Some(n as $ty); 121 | | Ok(()) ... | 132 | | } 133 | | } | |_________________^ ... 140 | float!(f64); | ----------- in this macro invocation | = help: move this `impl` block outside the of the current associated function `begin` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <rust-lang/rust#120363> = note: this warning originates in the macro `float` (in Nightly builds, run with -Z macro-backtrace for more info) warning: non-local `impl` definition, they should be avoided as they go against expectation --> src/de/impls.rs:144:9 | 144 | / impl<T: Deserialize> Visitor for Place<Box<T>> { 145 | | fn null(&mut self) -> Result<()> { 146 | | let mut out = None; 147 | | Deserialize::begin(&mut out).null()?; ... | 205 | | } 206 | | } | |_________^ | = help: move this `impl` block outside the of the current associated function `begin` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <rust-lang/rust#120363> warning: non-local `impl` definition, they should be avoided as they go against expectation --> src/de/impls.rs:270:9 | 270 | / impl<T: Deserialize> Visitor for Place<Option<T>> { 271 | | fn null(&mut self) -> Result<()> { 272 | | self.out = Some(None); 273 | | Ok(()) ... | 309 | | } 310 | | } | |_________^ | = help: move this `impl` block outside the of the current associated function `begin` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <rust-lang/rust#120363> warning: non-local `impl` definition, they should be avoided as they go against expectation --> src/de/impls.rs:318:9 | 318 | / impl<A: Deserialize, B: Deserialize> Visitor for Place<(A, B)> { 319 | | fn seq(&mut self) -> Result<Box<dyn Seq + '_>> { 320 | | Ok(Box::new(TupleBuilder { 321 | | out: &mut self.out, ... | 324 | | } 325 | | } | |_________^ | = help: move this `impl` block outside the of the current associated function `begin` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <rust-lang/rust#120363> warning: non-local `impl` definition, they should be avoided as they go against expectation --> src/de/impls.rs:359:9 | 359 | / impl<T: Deserialize> Visitor for Place<Vec<T>> { 360 | | fn seq(&mut self) -> Result<Box<dyn Seq + '_>> { 361 | | Ok(Box::new(VecBuilder { 362 | | out: &mut self.out, ... | 366 | | } 367 | | } | |_________^ | = help: move this `impl` block outside the of the current associated function `begin` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <rust-lang/rust#120363> warning: non-local `impl` definition, they should be avoided as they go against expectation --> src/de/impls.rs:402:9 | 402 | / impl<T: Deserialize, const N: usize> Visitor for Place<[T; N]> { 403 | | fn seq(&mut self) -> Result<Box<dyn Seq + '_>> { 404 | | Ok(Box::new(ArrayBuilder { 405 | | out: &mut self.out, ... | 410 | | } 411 | | } | |_________^ | = help: move this `impl` block outside the of the current associated function `begin` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <rust-lang/rust#120363> warning: non-local `impl` definition, they should be avoided as they go against expectation --> src/de/impls.rs:472:9 | 472 | / impl<K, V, H> Visitor for Place<HashMap<K, V, H>> 473 | | where 474 | | K: FromStr + Hash + Eq, 475 | | V: Deserialize, ... | 485 | | } 486 | | } | |_________^ | = help: move this `impl` block outside the of the current associated function `begin` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <rust-lang/rust#120363> warning: non-local `impl` definition, they should be avoided as they go against expectation --> src/de/impls.rs:532:9 | 532 | / impl<K: FromStr + Ord, V: Deserialize> Visitor for Place<BTreeMap<K, V>> { 533 | | fn map(&mut self) -> Result<Box<dyn Map + '_>> { 534 | | Ok(Box::new(MapBuilder { 535 | | out: &mut self.out, ... | 540 | | } 541 | | } | |_________^ | = help: move this `impl` block outside the of the current associated function `begin` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <rust-lang/rust#120363> warning: non-local `impl` definition, they should be avoided as they go against expectation --> src/json/value.rs:75:9 | 75 | / impl Visitor for Place<Value> { 76 | | fn null(&mut self) -> Result<()> { 77 | | self.out = Some(Value::Null); 78 | | Ok(()) ... | 121 | | } 122 | | } | |_________^ | = help: move this `impl` block outside the of the current associated function `begin` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <rust-lang/rust#120363> warning: non-local `impl` definition, they should be avoided as they go against expectation --> src/json/number.rs:37:9 | 37 | / impl Visitor for Place<Number> { 38 | | fn negative(&mut self, n: i64) -> Result<()> { 39 | | self.out = Some(Number::I64(n)); 40 | | Ok(()) ... | 51 | | } 52 | | } | |_________^ | = help: move this `impl` block outside the of the current associated function `begin` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <rust-lang/rust#120363> warning: non-local `impl` definition, they should be avoided as they go against expectation --> src/json/array.rs:116:9 | 116 | / impl Visitor for Place<Array> { 117 | | fn seq(&mut self) -> Result<Box<dyn Seq + '_>> { 118 | | Ok(Box::new(ArrayBuilder { 119 | | out: &mut self.out, ... | 123 | | } 124 | | } | |_________^ | = help: move this `impl` block outside the of the current associated function `begin` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <rust-lang/rust#120363> warning: non-local `impl` definition, they should be avoided as they go against expectation --> src/json/object.rs:119:9 | 119 | / impl Visitor for Place<Object> { 120 | | fn map(&mut self) -> Result<Box<dyn Map + '_>> { 121 | | Ok(Box::new(ObjectBuilder { 122 | | out: &mut self.out, ... | 127 | | } 128 | | } | |_________^ | = help: move this `impl` block outside the of the current associated function `begin` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <rust-lang/rust#120363>
I pasted an example of such a warning into the summary above. This issue previously was not appearing in a GitHub search for "non_local_definitions". |
rust-lang/rust#121621 warning: non-local `impl` definition, they should be avoided as they go against expectation --> tests/test.rs:2338:5 | 2338 | / impl<'de> Deserialize<'de> for &'de RawMapKey { 2339 | | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> 2340 | | where 2341 | | D: serde::Deserializer<'de>, ... | 2345 | | } 2346 | | } | |_____^ | = help: move this `impl` block outside the of the current function `test_raw_value_in_map_key` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <rust-lang/rust#120363> = note: `#[warn(non_local_definitions)]` on by default
Should an exception be made for #[fundamental] types? Filed as #121621. |
Implement RFC 3373: Avoid non-local definitions in functions This PR implements [RFC 3373: Avoid non-local definitions in functions](rust-lang/rust#120363).
rust-lang/rust#121621 warning: non-local `impl` definition, they should be avoided as they go against expectation --> tests/macros.rs:11:5 | 11 | clone_trait_object!(Trait); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: move this `impl` block outside the of the current function `test_plain` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <rust-lang/rust#120363> = note: the macro `$crate::__internal_clone_trait_object` may come from an old version of the `dyn_clone` crate, try updating your dependency with `cargo update -p dyn_clone` = note: `#[warn(non_local_definitions)]` on by default = note: this warning originates in the macro `$crate::__internal_clone_trait_object` which comes from the expansion of the macro `clone_trait_object` (in Nightly builds, run with -Z macro-backtrace for more info) warning: non-local `impl` definition, they should be avoided as they go against expectation --> tests/macros.rs:11:5 | 11 | clone_trait_object!(Trait); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: move this `impl` block outside the of the current function `test_plain` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <rust-lang/rust#120363> = note: the macro `$crate::__internal_clone_trait_object` may come from an old version of the `dyn_clone` crate, try updating your dependency with `cargo update -p dyn_clone` = note: this warning originates in the macro `$crate::__internal_clone_trait_object` which comes from the expansion of the macro `clone_trait_object` (in Nightly builds, run with -Z macro-backtrace for more info) warning: non-local `impl` definition, they should be avoided as they go against expectation --> tests/macros.rs:23:5 | 23 | clone_trait_object!(<T> Trait<T>); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: move this `impl` block outside the of the current function `test_type_parameter` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <rust-lang/rust#120363> = note: the macro `$crate::__internal_clone_trait_object` may come from an old version of the `dyn_clone` crate, try updating your dependency with `cargo update -p dyn_clone` = note: this warning originates in the macro `$crate::__internal_clone_trait_object` which comes from the expansion of the macro `clone_trait_object` (in Nightly builds, run with -Z macro-backtrace for more info) warning: non-local `impl` definition, they should be avoided as they go against expectation --> tests/macros.rs:32:5 | 32 | clone_trait_object!(<T: PartialEq<T>, U> Trait<T, U>); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: move this `impl` block outside the of the current function `test_generic_bound` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <rust-lang/rust#120363> = note: the macro `$crate::__internal_clone_trait_object` may come from an old version of the `dyn_clone` crate, try updating your dependency with `cargo update -p dyn_clone` = note: this warning originates in the macro `$crate::__internal_clone_trait_object` which comes from the expansion of the macro `clone_trait_object` (in Nightly builds, run with -Z macro-backtrace for more info) warning: non-local `impl` definition, they should be avoided as they go against expectation --> tests/macros.rs:45:5 | 45 | clone_trait_object!(<T> Trait<T> where T: Clone); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: move this `impl` block outside the of the current function `test_where_clause` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <rust-lang/rust#120363> = note: the macro `$crate::__internal_clone_trait_object` may come from an old version of the `dyn_clone` crate, try updating your dependency with `cargo update -p dyn_clone` = note: this warning originates in the macro `$crate::__internal_clone_trait_object` which comes from the expansion of the macro `clone_trait_object` (in Nightly builds, run with -Z macro-backtrace for more info) warning: non-local `impl` definition, they should be avoided as they go against expectation --> tests/macros.rs:54:5 | 54 | clone_trait_object!(<'a> Trait<'a>); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: move this `impl` block outside the of the current function `test_lifetime` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <rust-lang/rust#120363> = note: the macro `$crate::__internal_clone_trait_object` may come from an old version of the `dyn_clone` crate, try updating your dependency with `cargo update -p dyn_clone` = note: this warning originates in the macro `$crate::__internal_clone_trait_object` which comes from the expansion of the macro `clone_trait_object` (in Nightly builds, run with -Z macro-backtrace for more info)
warning: non-local `impl` definition, they should be avoided as they go against expectation --> tests/test_error.rs:412:13 | 412 | / impl<'de> Visitor<'de> for X { 413 | | type Value = X; 414 | | 415 | | fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { ... | 429 | | } 430 | | } | |_____________^ | = help: move this `impl` block outside the of the current associated function `deserialize` and up 2 bodies = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <rust-lang/rust#120363> = note: `#[warn(non_local_definitions)]` on by default
This macro needs to be redesigned if this ever becomes a hard error. warning: non-local `impl` definition, they should be avoided as they go against expectation --> tests/test_generics.rs:7:1 | 7 | / library! { 8 | | use simple { 9 | | trait Simple { 10 | | fn simple(); ... | 14 | | } 15 | | } | |_^ | = help: move this `impl` block outside the of the current associated function `simple` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <rust-lang/rust#120363> = note: the macro `library` may come from an old version of the `reflect_internal` crate, try updating your dependency with `cargo update -p reflect_internal` = note: `#[warn(non_local_definitions)]` on by default = note: this warning originates in the macro `library` (in Nightly builds, run with -Z macro-backtrace for more info) warning: non-local `impl` definition, they should be avoided as they go against expectation --> tests/test_parse_trait_objects.rs:6:1 | 6 | / library! { 7 | | use Mod { 8 | | type Struct; 9 | | trait Trait {} ... | 16 | | } 17 | | } | |_^ | = help: move this `impl` block outside the of the current associated function `single_dyn` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <rust-lang/rust#120363> = note: the macro `library` may come from an old version of the `reflect_internal` crate, try updating your dependency with `cargo update -p reflect_internal` = note: `#[warn(non_local_definitions)]` on by default = note: this warning originates in the macro `library` (in Nightly builds, run with -Z macro-backtrace for more info) warning: non-local `impl` definition, they should be avoided as they go against expectation --> tests/test_parse_trait_objects.rs:6:1 | 6 | / library! { 7 | | use Mod { 8 | | type Struct; 9 | | trait Trait {} ... | 16 | | } 17 | | } | |_^ | = help: move this `impl` block outside the of the current associated function `double_dyn` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <rust-lang/rust#120363> = note: the macro `library` may come from an old version of the `reflect_internal` crate, try updating your dependency with `cargo update -p reflect_internal` = note: this warning originates in the macro `library` (in Nightly builds, run with -Z macro-backtrace for more info) warning: non-local `impl` definition, they should be avoided as they go against expectation --> tests/test_zero_args.rs:7:1 | 7 | / library! { 8 | | use zero { 9 | | trait Zero { 10 | | fn zero(); 11 | | } 12 | | } 13 | | } | |_^ | = help: move this `impl` block outside the of the current associated function `zero` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <rust-lang/rust#120363> = note: the macro `library` may come from an old version of the `reflect_internal` crate, try updating your dependency with `cargo update -p reflect_internal` = note: `#[warn(non_local_definitions)]` on by default = note: this warning originates in the macro `library` (in Nightly builds, run with -Z macro-backtrace for more info) warning: non-local `impl` definition, they should be avoided as they go against expectation --> tests/test_field_access.rs:36:1 | 36 | / library! { 37 | | use base { 38 | | type FieldAccessor; 39 | | impl FieldAccessor { ... | 46 | | } 47 | | } | |_^ | = help: move this `impl` block outside the of the current associated function `access_field` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <rust-lang/rust#120363> = note: the macro `library` may come from an old version of the `reflect_internal` crate, try updating your dependency with `cargo update -p reflect_internal` = note: `#[warn(non_local_definitions)]` on by default = note: this warning originates in the macro `library` (in Nightly builds, run with -Z macro-backtrace for more info) warning: non-local `impl` definition, they should be avoided as they go against expectation --> tests/test_field_access.rs:36:1 | 36 | / library! { 37 | | use base { 38 | | type FieldAccessor; 39 | | impl FieldAccessor { ... | 46 | | } 47 | | } | |_^ | = help: move this `impl` block outside the of the current associated function `trivial` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <rust-lang/rust#120363> = note: the macro `library` may come from an old version of the `reflect_internal` crate, try updating your dependency with `cargo update -p reflect_internal` = note: this warning originates in the macro `library` (in Nightly builds, run with -Z macro-backtrace for more info) warning: non-local `impl` definition, they should be avoided as they go against expectation --> tests/test_tuple.rs:7:1 | 7 | / library! { 8 | | use tuple { 9 | | type One; 10 | | type Two; ... | 15 | | } 16 | | } | |_^ | = help: move this `impl` block outside the of the current associated function `swap` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <rust-lang/rust#120363> = note: the macro `library` may come from an old version of the `reflect_internal` crate, try updating your dependency with `cargo update -p reflect_internal` = note: `#[warn(non_local_definitions)]` on by default = note: this warning originates in the macro `library` (in Nightly builds, run with -Z macro-backtrace for more info) warning: non-local `impl` definition, they should be avoided as they go against expectation --> tests/test_displaydoc.rs:16:1 | 16 | / reflect::library! { 17 | | extern crate std { 18 | | mod fmt { 19 | | type Formatter; ... | 28 | | } 29 | | } | |_^ | = help: move this `impl` block outside the of the current associated function `fmt` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <rust-lang/rust#120363> = note: the macro `reflect::library` may come from an old version of the `reflect_internal` crate, try updating your dependency with `cargo update -p reflect_internal` = note: `#[warn(non_local_definitions)]` on by default = note: this warning originates in the macro `reflect::library` (in Nightly builds, run with -Z macro-backtrace for more info) warning: non-local `impl` definition, they should be avoided as they go against expectation --> tests/debug/mod.rs:10:1 | 10 | / reflect::library! { 11 | | extern crate std { 12 | | mod fmt { 13 | | type Formatter; ... | 30 | | } 31 | | } | |_^ | = help: move this `impl` block outside the of the current associated function `fmt` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <rust-lang/rust#120363> = note: the macro `reflect::library` may come from an old version of the `reflect_internal` crate, try updating your dependency with `cargo update -p reflect_internal` = note: `#[warn(non_local_definitions)]` on by default = note: this warning originates in the macro `reflect::library` (in Nightly builds, run with -Z macro-backtrace for more info) warning: non-local `impl` definition, they should be avoided as they go against expectation --> tests/debug/mod.rs:10:1 | 10 | / reflect::library! { 11 | | extern crate std { 12 | | mod fmt { 13 | | type Formatter; ... | 30 | | } 31 | | } | |_^ | = help: move this `impl` block outside the of the current associated function `debug_struct` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <rust-lang/rust#120363> = note: the macro `reflect::library` may come from an old version of the `reflect_internal` crate, try updating your dependency with `cargo update -p reflect_internal` = note: this warning originates in the macro `reflect::library` (in Nightly builds, run with -Z macro-backtrace for more info) warning: non-local `impl` definition, they should be avoided as they go against expectation --> tests/debug/mod.rs:10:1 | 10 | / reflect::library! { 11 | | extern crate std { 12 | | mod fmt { 13 | | type Formatter; ... | 30 | | } 31 | | } | |_^ | = help: move this `impl` block outside the of the current associated function `field` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <rust-lang/rust#120363> = note: the macro `reflect::library` may come from an old version of the `reflect_internal` crate, try updating your dependency with `cargo update -p reflect_internal` = note: this warning originates in the macro `reflect::library` (in Nightly builds, run with -Z macro-backtrace for more info) warning: non-local `impl` definition, they should be avoided as they go against expectation --> tests/debug/mod.rs:10:1 | 10 | / reflect::library! { 11 | | extern crate std { 12 | | mod fmt { 13 | | type Formatter; ... | 30 | | } 31 | | } | |_^ | = help: move this `impl` block outside the of the current associated function `finish` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <rust-lang/rust#120363> = note: the macro `reflect::library` may come from an old version of the `reflect_internal` crate, try updating your dependency with `cargo update -p reflect_internal` = note: this warning originates in the macro `reflect::library` (in Nightly builds, run with -Z macro-backtrace for more info)
In typical usage, I think this would not be triggered. We need to reorganize the test. warning: non-local `macro_rules!` definition, they should be avoided as they go against expectation --> tests/distributed_slice.rs:33:5 | 33 | #[distributed_slice] | ^^^^^^^^^^^^^^^^^^^^ | = help: remove the `#[macro_export]` or move this `macro_rules!` outside the of the current function `test_empty` = note: a `macro_rules!` definition is non-local if it is nested inside an item and has a `#[macro_export]` attribute = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <rust-lang/rust#120363> = note: the attribute macro `distributed_slice` may come from an old version of the `linkme_impl` crate, try updating your dependency with `cargo update -p linkme_impl` = note: `#[warn(non_local_definitions)]` on by default = note: this warning originates in the attribute macro `distributed_slice` (in Nightly builds, run with -Z macro-backtrace for more info) warning: non-local `macro_rules!` definition, they should be avoided as they go against expectation --> tests/distributed_slice.rs:43:5 | 43 | #[distributed_slice] | ^^^^^^^^^^^^^^^^^^^^ | = help: remove the `#[macro_export]` or move this `macro_rules!` outside the of the current function `test_non_copy` = note: a `macro_rules!` definition is non-local if it is nested inside an item and has a `#[macro_export]` attribute = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <rust-lang/rust#120363> = note: the attribute macro `distributed_slice` may come from an old version of the `linkme_impl` crate, try updating your dependency with `cargo update -p linkme_impl` = note: this warning originates in the attribute macro `distributed_slice` (in Nightly builds, run with -Z macro-backtrace for more info) warning: non-local `macro_rules!` definition, they should be avoided as they go against expectation --> tests/distributed_slice.rs:54:5 | 54 | #[distributed_slice] | ^^^^^^^^^^^^^^^^^^^^ | = help: remove the `#[macro_export]` or move this `macro_rules!` outside the of the current function `test_interior_mutable` = note: a `macro_rules!` definition is non-local if it is nested inside an item and has a `#[macro_export]` attribute = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <rust-lang/rust#120363> = note: the attribute macro `distributed_slice` may come from an old version of the `linkme_impl` crate, try updating your dependency with `cargo update -p linkme_impl` = note: this warning originates in the attribute macro `distributed_slice` (in Nightly builds, run with -Z macro-backtrace for more info) warning: non-local `macro_rules!` definition, they should be avoided as they go against expectation --> tests/distributed_slice.rs:66:5 | 66 | #[distributed_slice] | ^^^^^^^^^^^^^^^^^^^^ | = help: remove the `#[macro_export]` or move this `macro_rules!` outside the of the current function `test_elided_lifetime` = note: a `macro_rules!` definition is non-local if it is nested inside an item and has a `#[macro_export]` attribute = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <rust-lang/rust#120363> = note: the attribute macro `distributed_slice` may come from an old version of the `linkme_impl` crate, try updating your dependency with `cargo update -p linkme_impl` = note: this warning originates in the attribute macro `distributed_slice` (in Nightly builds, run with -Z macro-backtrace for more info) warning: non-local `macro_rules!` definition, they should be avoided as they go against expectation --> tests/distributed_slice.rs:79:5 | 79 | #[distributed_slice] | ^^^^^^^^^^^^^^^^^^^^ | = help: remove the `#[macro_export]` or move this `macro_rules!` outside the of the current function `test_legacy_syntax` = note: a `macro_rules!` definition is non-local if it is nested inside an item and has a `#[macro_export]` attribute = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <rust-lang/rust#120363> = note: the attribute macro `distributed_slice` may come from an old version of the `linkme_impl` crate, try updating your dependency with `cargo update -p linkme_impl` = note: this warning originates in the attribute macro `distributed_slice` (in Nightly builds, run with -Z macro-backtrace for more info)
In typical usage, I think this would not be triggered. We need to reorganize the test. warning: non-local `macro_rules!` definition, they should be avoided as they go against expectation --> tests/distributed_slice.rs:33:5 | 33 | #[distributed_slice] | ^^^^^^^^^^^^^^^^^^^^ | = help: remove the `#[macro_export]` or move this `macro_rules!` outside the of the current function `test_empty` = note: a `macro_rules!` definition is non-local if it is nested inside an item and has a `#[macro_export]` attribute = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <rust-lang/rust#120363> = note: the attribute macro `distributed_slice` may come from an old version of the `linkme_impl` crate, try updating your dependency with `cargo update -p linkme_impl` = note: `#[warn(non_local_definitions)]` on by default = note: this warning originates in the attribute macro `distributed_slice` (in Nightly builds, run with -Z macro-backtrace for more info) warning: non-local `macro_rules!` definition, they should be avoided as they go against expectation --> tests/distributed_slice.rs:43:5 | 43 | #[distributed_slice] | ^^^^^^^^^^^^^^^^^^^^ | = help: remove the `#[macro_export]` or move this `macro_rules!` outside the of the current function `test_non_copy` = note: a `macro_rules!` definition is non-local if it is nested inside an item and has a `#[macro_export]` attribute = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <rust-lang/rust#120363> = note: the attribute macro `distributed_slice` may come from an old version of the `linkme_impl` crate, try updating your dependency with `cargo update -p linkme_impl` = note: this warning originates in the attribute macro `distributed_slice` (in Nightly builds, run with -Z macro-backtrace for more info) warning: non-local `macro_rules!` definition, they should be avoided as they go against expectation --> tests/distributed_slice.rs:54:5 | 54 | #[distributed_slice] | ^^^^^^^^^^^^^^^^^^^^ | = help: remove the `#[macro_export]` or move this `macro_rules!` outside the of the current function `test_interior_mutable` = note: a `macro_rules!` definition is non-local if it is nested inside an item and has a `#[macro_export]` attribute = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <rust-lang/rust#120363> = note: the attribute macro `distributed_slice` may come from an old version of the `linkme_impl` crate, try updating your dependency with `cargo update -p linkme_impl` = note: this warning originates in the attribute macro `distributed_slice` (in Nightly builds, run with -Z macro-backtrace for more info) warning: non-local `macro_rules!` definition, they should be avoided as they go against expectation --> tests/distributed_slice.rs:66:5 | 66 | #[distributed_slice] | ^^^^^^^^^^^^^^^^^^^^ | = help: remove the `#[macro_export]` or move this `macro_rules!` outside the of the current function `test_elided_lifetime` = note: a `macro_rules!` definition is non-local if it is nested inside an item and has a `#[macro_export]` attribute = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <rust-lang/rust#120363> = note: the attribute macro `distributed_slice` may come from an old version of the `linkme_impl` crate, try updating your dependency with `cargo update -p linkme_impl` = note: this warning originates in the attribute macro `distributed_slice` (in Nightly builds, run with -Z macro-backtrace for more info) warning: non-local `macro_rules!` definition, they should be avoided as they go against expectation --> tests/distributed_slice.rs:79:5 | 79 | #[distributed_slice] | ^^^^^^^^^^^^^^^^^^^^ | = help: remove the `#[macro_export]` or move this `macro_rules!` outside the of the current function `test_legacy_syntax` = note: a `macro_rules!` definition is non-local if it is nested inside an item and has a `#[macro_export]` attribute = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <rust-lang/rust#120363> = note: the attribute macro `distributed_slice` may come from an old version of the `linkme_impl` crate, try updating your dependency with `cargo update -p linkme_impl` = note: this warning originates in the attribute macro `distributed_slice` (in Nightly builds, run with -Z macro-backtrace for more info) error: non-local `macro_rules!` definition, they should be avoided as they go against expectation --> tests/cortex/src/main.rs:35:5 | 35 | #[distributed_slice] | ^^^^^^^^^^^^^^^^^^^^ | = help: remove the `#[macro_export]` or move this `macro_rules!` outside the of the current function `__cortex_m_rt_main` = note: a `macro_rules!` definition is non-local if it is nested inside an item and has a `#[macro_export]` attribute = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <rust-lang/rust#120363> = note: the attribute macro `distributed_slice` may come from an old version of the `linkme_impl` crate, try updating your dependency with `cargo update -p linkme_impl` = note: `-D non-local-definitions` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(non_local_definitions)]` = note: this error originates in the attribute macro `distributed_slice` (in Nightly builds, run with -Z macro-backtrace for more info)
Fixes a non_local_definitions warning in the generated code. warning: non-local `impl` definition, they should be avoided as they go against expectation --> tests/test.rs:18:5 | 18 | #[typetag::serde] | ^^^^^^^^^^^^^^^^^ | = help: move this `impl` block outside the of the current constant `_Trait_registry` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <rust-lang/rust#120363> = note: the attribute macro `typetag::serde` may come from an old version of the `typetag_impl` crate, try updating your dependency with `cargo update -p typetag_impl` = note: `#[warn(non_local_definitions)]` on by default = note: this warning originates in the attribute macro `typetag::serde` (in Nightly builds, run with -Z macro-backtrace for more info) warning: non-local `impl` definition, they should be avoided as they go against expectation --> tests/test.rs:18:5 | 18 | #[typetag::serde] | ^^^^^^^^^^^^^^^^^ | = help: move this `impl` block outside the of the current constant `_Trait_registry` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <rust-lang/rust#120363> = note: the attribute macro `typetag::serde` may come from an old version of the `typetag_impl` crate, try updating your dependency with `cargo update -p typetag_impl` = note: this warning originates in the attribute macro `typetag::serde` (in Nightly builds, run with -Z macro-backtrace for more info) warning: non-local `impl` definition, they should be avoided as they go against expectation --> tests/test.rs:71:5 | 71 | #[typetag::serde(tag = "type")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: move this `impl` block outside the of the current constant `_Trait_registry` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <rust-lang/rust#120363> = note: the attribute macro `typetag::serde` may come from an old version of the `typetag_impl` crate, try updating your dependency with `cargo update -p typetag_impl` = note: this warning originates in the attribute macro `typetag::serde` (in Nightly builds, run with -Z macro-backtrace for more info) warning: non-local `impl` definition, they should be avoided as they go against expectation --> tests/test.rs:124:5 | 124 | #[typetag::serde(tag = "type", content = "content")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: move this `impl` block outside the of the current constant `_Trait_registry` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <rust-lang/rust#120363> = note: the attribute macro `typetag::serde` may come from an old version of the `typetag_impl` crate, try updating your dependency with `cargo update -p typetag_impl` = note: this warning originates in the attribute macro `typetag::serde` (in Nightly builds, run with -Z macro-backtrace for more info) warning: non-local `impl` definition, they should be avoided as they go against expectation --> tests/test.rs:192:5 | 192 | #[typetag::serde] | ^^^^^^^^^^^^^^^^^ | = help: move this `impl` block outside the of the current constant `_Trait_registry` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <rust-lang/rust#120363> = note: the attribute macro `typetag::serde` may come from an old version of the `typetag_impl` crate, try updating your dependency with `cargo update -p typetag_impl` = note: this warning originates in the attribute macro `typetag::serde` (in Nightly builds, run with -Z macro-backtrace for more info) warning: non-local `impl` definition, they should be avoided as they go against expectation --> tests/test.rs:278:5 | 278 | #[typetag::serde(tag = "type", default_variant = "A")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: move this `impl` block outside the of the current constant `_Trait_registry` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <rust-lang/rust#120363> = note: the attribute macro `typetag::serde` may come from an old version of the `typetag_impl` crate, try updating your dependency with `cargo update -p typetag_impl` = note: this warning originates in the attribute macro `typetag::serde` (in Nightly builds, run with -Z macro-backtrace for more info) warning: non-local `impl` definition, they should be avoided as they go against expectation --> tests/test.rs:322:5 | 322 | #[typetag::serde(tag = "type", content = "content", default_variant = "A")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: move this `impl` block outside the of the current constant `_Trait_registry` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <rust-lang/rust#120363> = note: the attribute macro `typetag::serde` may come from an old version of the `typetag_impl` crate, try updating your dependency with `cargo update -p typetag_impl` = note: this warning originates in the attribute macro `typetag::serde` (in Nightly builds, run with -Z macro-backtrace for more info) warning: non-local `impl` definition, they should be avoided as they go against expectation --> tests/test.rs:366:5 | 366 | #[typetag::serde(tag = "type", content = "content", deny_unknown_fields)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: move this `impl` block outside the of the current constant `_Trait_registry` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <rust-lang/rust#120363> = note: the attribute macro `typetag::serde` may come from an old version of the `typetag_impl` crate, try updating your dependency with `cargo update -p typetag_impl` = note: this warning originates in the attribute macro `typetag::serde` (in Nightly builds, run with -Z macro-backtrace for more info) warning: non-local `impl` definition, they should be avoided as they go against expectation --> tests/test.rs:393:5 | 393 | #[typetag::serde] | ^^^^^^^^^^^^^^^^^ | = help: move this `impl` block outside the of the current constant `_Neither_registry` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <rust-lang/rust#120363> = note: the attribute macro `typetag::serde` may come from an old version of the `typetag_impl` crate, try updating your dependency with `cargo update -p typetag_impl` = note: this warning originates in the attribute macro `typetag::serde` (in Nightly builds, run with -Z macro-backtrace for more info) warning: non-local `impl` definition, they should be avoided as they go against expectation --> tests/test.rs:396:5 | 396 | #[typetag::serde] | ^^^^^^^^^^^^^^^^^ | = help: move this `impl` block outside the of the current constant `_Sendable_registry` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <rust-lang/rust#120363> = note: the attribute macro `typetag::serde` may come from an old version of the `typetag_impl` crate, try updating your dependency with `cargo update -p typetag_impl` = note: this warning originates in the attribute macro `typetag::serde` (in Nightly builds, run with -Z macro-backtrace for more info) warning: non-local `impl` definition, they should be avoided as they go against expectation --> tests/test.rs:399:5 | 399 | #[typetag::serde] | ^^^^^^^^^^^^^^^^^ | = help: move this `impl` block outside the of the current constant `_Syncable_registry` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <rust-lang/rust#120363> = note: the attribute macro `typetag::serde` may come from an old version of the `typetag_impl` crate, try updating your dependency with `cargo update -p typetag_impl` = note: this warning originates in the attribute macro `typetag::serde` (in Nightly builds, run with -Z macro-backtrace for more info) warning: non-local `impl` definition, they should be avoided as they go against expectation --> tests/test.rs:402:5 | 402 | #[typetag::serde] | ^^^^^^^^^^^^^^^^^ | = help: move this `impl` block outside the of the current constant `_Both_registry` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <rust-lang/rust#120363> = note: the attribute macro `typetag::serde` may come from an old version of the `typetag_impl` crate, try updating your dependency with `cargo update -p typetag_impl` = note: this warning originates in the attribute macro `typetag::serde` (in Nightly builds, run with -Z macro-backtrace for more info) warning: non-local `impl` definition, they should be avoided as they go against expectation --> tests/test.rs:459:5 | 459 | #[typetag::serialize] | ^^^^^^^^^^^^^^^^^^^^^ | = help: move this `impl` block outside the of the current constant `_Generic_registry` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <rust-lang/rust#120363> = note: the attribute macro `typetag::serialize` may come from an old version of the `typetag_impl` crate, try updating your dependency with `cargo update -p typetag_impl` = note: this warning originates in the attribute macro `typetag::serialize` (in Nightly builds, run with -Z macro-backtrace for more info) warning: non-local `impl` definition, they should be avoided as they go against expectation --> tests/test.rs:466:5 | 466 | #[typetag::serde] | ^^^^^^^^^^^^^^^^^ | = help: move this `impl` block outside the of the current constant `_Trait_registry` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <rust-lang/rust#120363> = note: the attribute macro `typetag::serde` may come from an old version of the `typetag_impl` crate, try updating your dependency with `cargo update -p typetag_impl` = note: this warning originates in the attribute macro `typetag::serde` (in Nightly builds, run with -Z macro-backtrace for more info) warning: non-local `impl` definition, they should be avoided as they go against expectation --> tests/test.rs:483:5 | 483 | #[typetag::serde] | ^^^^^^^^^^^^^^^^^ | = help: move this `impl` block outside the of the current constant `_Base_registry` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <rust-lang/rust#120363> = note: the attribute macro `typetag::serde` may come from an old version of the `typetag_impl` crate, try updating your dependency with `cargo update -p typetag_impl` = note: this warning originates in the attribute macro `typetag::serde` (in Nightly builds, run with -Z macro-backtrace for more info) warning: non-local `impl` definition, they should be avoided as they go against expectation --> tests/test.rs:492:5 | 492 | #[typetag::serde] | ^^^^^^^^^^^^^^^^^ | = help: move this `impl` block outside the of the current constant `_Derived_registry` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <rust-lang/rust#120363> = note: the attribute macro `typetag::serde` may come from an old version of the `typetag_impl` crate, try updating your dependency with `cargo update -p typetag_impl` = note: this warning originates in the attribute macro `typetag::serde` (in Nightly builds, run with -Z macro-backtrace for more info)
rust-lang/rust#121621 fn main() { #[typetag::serde] trait Trait {} } warning: non-local `impl` definition, they should be avoided as they go against expectation --> src/main.rs:2:5 | 2 | #[typetag::serde] | ^^^^^^^^^^^^^^^^^ | = help: move this `impl` block outside the of the current constant `_` and up 2 bodies = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <rust-lang/rust#120363> = note: the attribute macro `typetag::serde` may come from an old version of the `typetag_impl` crate, try updating your dependency with `cargo update -p typetag_impl` = note: `#[warn(non_local_definitions)]` on by default = note: this warning originates in the attribute macro `typetag::serde` (in Nightly builds, run with -Z macro-backtrace for more info)
rust-lang/rust#121621 fn main() { #[typetag::serde] trait Trait {} } warning: non-local `impl` definition, they should be avoided as they go against expectation --> src/main.rs:2:5 | 2 | #[typetag::serde] | ^^^^^^^^^^^^^^^^^ | = help: move this `impl` block outside the of the current constant `_` and up 2 bodies = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <rust-lang/rust#120363> = note: the attribute macro `typetag::serde` may come from an old version of the `typetag_impl` crate, try updating your dependency with `cargo update -p typetag_impl` = note: `#[warn(non_local_definitions)]` on by default = note: this warning originates in the attribute macro `typetag::serde` (in Nightly builds, run with -Z macro-backtrace for more info)
warning: non-local `impl` definition, they should be avoided as they go against expectation --> src/lit.rs:564:13 | 564 | / impl LitStr { 565 | | pub(crate) fn debug( 566 | | &self, 567 | | formatter: &mut fmt::Formatter, ... | 574 | | } 575 | | } | |_____________^ | = help: move this `impl` block outside the of the current method `fmt` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = 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, they should be avoided as they go against expectation --> src/lit.rs:583:13 | 583 | / impl LitByteStr { 584 | | pub(crate) fn debug( 585 | | &self, 586 | | formatter: &mut fmt::Formatter, ... | 593 | | } 594 | | } | |_____________^ | = help: move this `impl` block outside the of the current method `fmt` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = 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, they should be avoided as they go against expectation --> src/lit.rs:602:13 | 602 | / impl LitByte { 603 | | pub(crate) fn debug( 604 | | &self, 605 | | formatter: &mut fmt::Formatter, ... | 612 | | } 613 | | } | |_____________^ | = help: move this `impl` block outside the of the current method `fmt` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = 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, they should be avoided as they go against expectation --> src/lit.rs:621:13 | 621 | / impl LitChar { 622 | | pub(crate) fn debug( 623 | | &self, 624 | | formatter: &mut fmt::Formatter, ... | 631 | | } 632 | | } | |_____________^ | = help: move this `impl` block outside the of the current method `fmt` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = 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, they should be avoided as they go against expectation --> src/lit.rs:640:13 | 640 | / impl LitInt { 641 | | pub(crate) fn debug( 642 | | &self, 643 | | formatter: &mut fmt::Formatter, ... | 650 | | } 651 | | } | |_____________^ | = help: move this `impl` block outside the of the current method `fmt` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = 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, they should be avoided as they go against expectation --> src/lit.rs:659:13 | 659 | / impl LitFloat { 660 | | pub(crate) fn debug( 661 | | &self, 662 | | formatter: &mut fmt::Formatter, ... | 669 | | } 670 | | } | |_____________^ | = help: move this `impl` block outside the of the current method `fmt` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = 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, they should be avoided as they go against expectation --> src/lit.rs:678:13 | 678 | / impl LitBool { 679 | | pub(crate) fn debug( 680 | | &self, 681 | | formatter: &mut fmt::Formatter, ... | 688 | | } 689 | | } | |_____________^ | = help: move this `impl` block outside the of the current method `fmt` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = 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, they should be avoided as they go against expectation --> src/gen/debug.rs:19:9 | 19 | / impl crate::AngleBracketedGenericArguments { 20 | | fn debug(&self, formatter: &mut fmt::Formatter, name: &str) -> fmt::Result { 21 | | let mut formatter = formatter.debug_struct(name); 22 | | formatter.field("colon2_token", &self.colon2_token); ... | 27 | | } 28 | | } | |_________^ | = help: move this `impl` block outside the of the current method `fmt` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = 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, they should be avoided as they go against expectation --> src/gen/debug.rs:334:9 | 334 | / impl crate::DataEnum { 335 | | fn debug(&self, formatter: &mut fmt::Formatter, name: &str) -> fmt::Result { 336 | | let mut formatter = formatter.debug_struct(name); 337 | | formatter.field("enum_token", &self.enum_token); ... | 341 | | } 342 | | } | |_________^ | = help: move this `impl` block outside the of the current method `fmt` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = 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, they should be avoided as they go against expectation --> src/gen/debug.rs:350:9 | 350 | / impl crate::DataStruct { 351 | | fn debug(&self, formatter: &mut fmt::Formatter, name: &str) -> fmt::Result { 352 | | let mut formatter = formatter.debug_struct(name); 353 | | formatter.field("struct_token", &self.struct_token); ... | 357 | | } 358 | | } | |_________^ | = help: move this `impl` block outside the of the current method `fmt` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = 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, they should be avoided as they go against expectation --> src/gen/debug.rs:366:9 | 366 | / impl crate::DataUnion { 367 | | fn debug(&self, formatter: &mut fmt::Formatter, name: &str) -> fmt::Result { 368 | | let mut formatter = formatter.debug_struct(name); 369 | | formatter.field("union_token", &self.union_token); ... | 372 | | } 373 | | } | |_________^ | = help: move this `impl` block outside the of the current method `fmt` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = 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, they should be avoided as they go against expectation --> src/gen/debug.rs:472:9 | 472 | / impl crate::ExprArray { 473 | | fn debug(&self, formatter: &mut fmt::Formatter, name: &str) -> fmt::Result { 474 | | let mut formatter = formatter.debug_struct(name); 475 | | formatter.field("attrs", &self.attrs); ... | 479 | | } 480 | | } | |_________^ | = help: move this `impl` block outside the of the current method `fmt` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = 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, they should be avoided as they go against expectation --> src/gen/debug.rs:488:9 | 488 | / impl crate::ExprAssign { 489 | | fn debug(&self, formatter: &mut fmt::Formatter, name: &str) -> fmt::Result { 490 | | let mut formatter = formatter.debug_struct(name); 491 | | formatter.field("attrs", &self.attrs); ... | 496 | | } 497 | | } | |_________^ | = help: move this `impl` block outside the of the current method `fmt` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = 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, they should be avoided as they go against expectation --> src/gen/debug.rs:505:9 | 505 | / impl crate::ExprAsync { 506 | | fn debug(&self, formatter: &mut fmt::Formatter, name: &str) -> fmt::Result { 507 | | let mut formatter = formatter.debug_struct(name); 508 | | formatter.field("attrs", &self.attrs); ... | 513 | | } 514 | | } | |_________^ | = help: move this `impl` block outside the of the current method `fmt` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = 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, they should be avoided as they go against expectation --> src/gen/debug.rs:522:9 | 522 | / impl crate::ExprAwait { 523 | | fn debug(&self, formatter: &mut fmt::Formatter, name: &str) -> fmt::Result { 524 | | let mut formatter = formatter.debug_struct(name); 525 | | formatter.field("attrs", &self.attrs); ... | 530 | | } 531 | | } | |_________^ | = help: move this `impl` block outside the of the current method `fmt` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = 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, they should be avoided as they go against expectation --> src/gen/debug.rs:539:9 | 539 | / impl crate::ExprBinary { 540 | | fn debug(&self, formatter: &mut fmt::Formatter, name: &str) -> fmt::Result { 541 | | let mut formatter = formatter.debug_struct(name); 542 | | formatter.field("attrs", &self.attrs); ... | 547 | | } 548 | | } | |_________^ | = help: move this `impl` block outside the of the current method `fmt` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = 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, they should be avoided as they go against expectation --> src/gen/debug.rs:556:9 | 556 | / impl crate::ExprBlock { 557 | | fn debug(&self, formatter: &mut fmt::Formatter, name: &str) -> fmt::Result { 558 | | let mut formatter = formatter.debug_struct(name); 559 | | formatter.field("attrs", &self.attrs); ... | 563 | | } 564 | | } | |_________^ | = help: move this `impl` block outside the of the current method `fmt` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = 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, they should be avoided as they go against expectation --> src/gen/debug.rs:572:9 | 572 | / impl crate::ExprBreak { 573 | | fn debug(&self, formatter: &mut fmt::Formatter, name: &str) -> fmt::Result { 574 | | let mut formatter = formatter.debug_struct(name); 575 | | formatter.field("attrs", &self.attrs); ... | 580 | | } 581 | | } | |_________^ | = help: move this `impl` block outside the of the current method `fmt` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = 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, they should be avoided as they go against expectation --> src/gen/debug.rs:589:9 | 589 | / impl crate::ExprCall { 590 | | fn debug(&self, formatter: &mut fmt::Formatter, name: &str) -> fmt::Result { 591 | | let mut formatter = formatter.debug_struct(name); 592 | | formatter.field("attrs", &self.attrs); ... | 597 | | } 598 | | } | |_________^ | = help: move this `impl` block outside the of the current method `fmt` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = 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, they should be avoided as they go against expectation --> src/gen/debug.rs:606:9 | 606 | / impl crate::ExprCast { 607 | | fn debug(&self, formatter: &mut fmt::Formatter, name: &str) -> fmt::Result { 608 | | let mut formatter = formatter.debug_struct(name); 609 | | formatter.field("attrs", &self.attrs); ... | 614 | | } 615 | | } | |_________^ | = help: move this `impl` block outside the of the current method `fmt` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = 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, they should be avoided as they go against expectation --> src/gen/debug.rs:623:9 | 623 | / impl crate::ExprClosure { 624 | | fn debug(&self, formatter: &mut fmt::Formatter, name: &str) -> fmt::Result { 625 | | let mut formatter = formatter.debug_struct(name); 626 | | formatter.field("attrs", &self.attrs); ... | 638 | | } 639 | | } | |_________^ | = help: move this `impl` block outside the of the current method `fmt` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = 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, they should be avoided as they go against expectation --> src/gen/debug.rs:647:9 | 647 | / impl crate::ExprConst { 648 | | fn debug(&self, formatter: &mut fmt::Formatter, name: &str) -> fmt::Result { 649 | | let mut formatter = formatter.debug_struct(name); 650 | | formatter.field("attrs", &self.attrs); ... | 654 | | } 655 | | } | |_________^ | = help: move this `impl` block outside the of the current method `fmt` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = 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, they should be avoided as they go against expectation --> src/gen/debug.rs:663:9 | 663 | / impl crate::ExprContinue { 664 | | fn debug(&self, formatter: &mut fmt::Formatter, name: &str) -> fmt::Result { 665 | | let mut formatter = formatter.debug_struct(name); 666 | | formatter.field("attrs", &self.attrs); ... | 670 | | } 671 | | } | |_________^ | = help: move this `impl` block outside the of the current method `fmt` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = 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, they should be avoided as they go against expectation --> src/gen/debug.rs:679:9 | 679 | / impl crate::ExprField { 680 | | fn debug(&self, formatter: &mut fmt::Formatter, name: &str) -> fmt::Result { 681 | | let mut formatter = formatter.debug_struct(name); 682 | | formatter.field("attrs", &self.attrs); ... | 687 | | } 688 | | } | |_________^ | = help: move this `impl` block outside the of the current method `fmt` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = 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, they should be avoided as they go against expectation --> src/gen/debug.rs:696:9 | 696 | / impl crate::ExprForLoop { 697 | | fn debug(&self, formatter: &mut fmt::Formatter, name: &str) -> fmt::Result { 698 | | let mut formatter = formatter.debug_struct(name); 699 | | formatter.field("attrs", &self.attrs); ... | 707 | | } 708 | | } | |_________^ | = help: move this `impl` block outside the of the current method `fmt` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = 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, they should be avoided as they go against expectation --> src/gen/debug.rs:716:9 | 716 | / impl crate::ExprGroup { 717 | | fn debug(&self, formatter: &mut fmt::Formatter, name: &str) -> fmt::Result { 718 | | let mut formatter = formatter.debug_struct(name); 719 | | formatter.field("attrs", &self.attrs); ... | 723 | | } 724 | | } | |_________^ | = help: move this `impl` block outside the of the current method `fmt` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = 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, they should be avoided as they go against expectation --> src/gen/debug.rs:732:9 | 732 | / impl crate::ExprIf { 733 | | fn debug(&self, formatter: &mut fmt::Formatter, name: &str) -> fmt::Result { 734 | | let mut formatter = formatter.debug_struct(name); 735 | | formatter.field("attrs", &self.attrs); ... | 741 | | } 742 | | } | |_________^ | = help: move this `impl` block outside the of the current method `fmt` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = 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, they should be avoided as they go against expectation --> src/gen/debug.rs:750:9 | 750 | / impl crate::ExprIndex { 751 | | fn debug(&self, formatter: &mut fmt::Formatter, name: &str) -> fmt::Result { 752 | | let mut formatter = formatter.debug_struct(name); 753 | | formatter.field("attrs", &self.attrs); ... | 758 | | } 759 | | } | |_________^ | = help: move this `impl` block outside the of the current method `fmt` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = 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, they should be avoided as they go against expectation --> src/gen/debug.rs:767:9 | 767 | / impl crate::ExprInfer { 768 | | fn debug(&self, formatter: &mut fmt::Formatter, name: &str) -> fmt::Result { 769 | | let mut formatter = formatter.debug_struct(name); 770 | | formatter.field("attrs", &self.attrs); ... | 773 | | } 774 | | } | |_________^ | = help: move this `impl` block outside the of the current method `fmt` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = 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, they should be avoided as they go against expectation --> src/gen/debug.rs:782:9 | 782 | / impl crate::ExprLet { 783 | | fn debug(&self, formatter: &mut fmt::Formatter, name: &str) -> fmt::Result { 784 | | let mut formatter = formatter.debug_struct(name); 785 | | formatter.field("attrs", &self.attrs); ... | 791 | | } 792 | | } | |_________^ | = help: move this `impl` block outside the of the current method `fmt` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = 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, they should be avoided as they go against expectation --> src/gen/debug.rs:800:9 | 800 | / impl crate::ExprLit { 801 | | fn debug(&self, formatter: &mut fmt::Formatter, name: &str) -> fmt::Result { 802 | | let mut formatter = formatter.debug_struct(name); 803 | | formatter.field("attrs", &self.attrs); ... | 806 | | } 807 | | } | |_________^ | = help: move this `impl` block outside the of the current method `fmt` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = 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, they should be avoided as they go against expectation --> src/gen/debug.rs:815:9 | 815 | / impl crate::ExprLoop { 816 | | fn debug(&self, formatter: &mut fmt::Formatter, name: &str) -> fmt::Result { 817 | | let mut formatter = formatter.debug_struct(name); 818 | | formatter.field("attrs", &self.attrs); ... | 823 | | } 824 | | } | |_________^ | = help: move this `impl` block outside the of the current method `fmt` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = 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, they should be avoided as they go against expectation --> src/gen/debug.rs:832:9 | 832 | / impl crate::ExprMacro { 833 | | fn debug(&self, formatter: &mut fmt::Formatter, name: &str) -> fmt::Result { 834 | | let mut formatter = formatter.debug_struct(name); 835 | | formatter.field("attrs", &self.attrs); ... | 838 | | } 839 | | } | |_________^ | = help: move this `impl` block outside the of the current method `fmt` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = 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, they should be avoided as they go against expectation --> src/gen/debug.rs:847:9 | 847 | / impl crate::ExprMatch { 848 | | fn debug(&self, formatter: &mut fmt::Formatter, name: &str) -> fmt::Result { 849 | | let mut formatter = formatter.debug_struct(name); 850 | | formatter.field("attrs", &self.attrs); ... | 856 | | } 857 | | } | |_________^ | = help: move this `impl` block outside the of the current method `fmt` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = 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, they should be avoided as they go against expectation --> src/gen/debug.rs:865:9 | 865 | / impl crate::ExprMethodCall { 866 | | fn debug(&self, formatter: &mut fmt::Formatter, name: &str) -> fmt::Result { 867 | | let mut formatter = formatter.debug_struct(name); 868 | | formatter.field("attrs", &self.attrs); ... | 876 | | } 877 | | } | |_________^ | = help: move this `impl` block outside the of the current method `fmt` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = 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, they should be avoided as they go against expectation --> src/gen/debug.rs:885:9 | 885 | / impl crate::ExprParen { 886 | | fn debug(&self, formatter: &mut fmt::Formatter, name: &str) -> fmt::Result { 887 | | let mut formatter = formatter.debug_struct(name); 888 | | formatter.field("attrs", &self.attrs); ... | 892 | | } 893 | | } | |_________^ | = help: move this `impl` block outside the of the current method `fmt` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = 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, they should be avoided as they go against expectation --> src/gen/debug.rs:901:9 | 901 | / impl crate::ExprPath { 902 | | fn debug(&self, formatter: &mut fmt::Formatter, name: &str) -> fmt::Result { 903 | | let mut formatter = formatter.debug_struct(name); 904 | | formatter.field("attrs", &self.attrs); ... | 908 | | } 909 | | } | |_________^ | = help: move this `impl` block outside the of the current method `fmt` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = 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, they should be avoided as they go against expectation --> src/gen/debug.rs:917:9 | 917 | / impl crate::ExprRange { 918 | | fn debug(&self, formatter: &mut fmt::Formatter, name: &str) -> fmt::Result { 919 | | let mut formatter = formatter.debug_struct(name); 920 | | formatter.field("attrs", &self.attrs); ... | 925 | | } 926 | | } | |_________^ | = help: move this `impl` block outside the of the current method `fmt` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = 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, they should be avoided as they go against expectation --> src/gen/debug.rs:934:9 | 934 | / impl crate::ExprReference { 935 | | fn debug(&self, formatter: &mut fmt::Formatter, name: &str) -> fmt::Result { 936 | | let mut formatter = formatter.debug_struct(name); 937 | | formatter.field("attrs", &self.attrs); ... | 942 | | } 943 | | } | |_________^ | = help: move this `impl` block outside the of the current method `fmt` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = 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, they should be avoided as they go against expectation --> src/gen/debug.rs:951:9 | 951 | / impl crate::ExprRepeat { 952 | | fn debug(&self, formatter: &mut fmt::Formatter, name: &str) -> fmt::Result { 953 | | let mut formatter = formatter.debug_struct(name); 954 | | formatter.field("attrs", &self.attrs); ... | 960 | | } 961 | | } | |_________^ | = help: move this `impl` block outside the of the current method `fmt` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = 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, they should be avoided as they go against expectation --> src/gen/debug.rs:969:9 | 969 | / impl crate::ExprReturn { 970 | | fn debug(&self, formatter: &mut fmt::Formatter, name: &str) -> fmt::Result { 971 | | let mut formatter = formatter.debug_struct(name); 972 | | formatter.field("attrs", &self.attrs); ... | 976 | | } 977 | | } | |_________^ | = help: move this `impl` block outside the of the current method `fmt` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = 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, they should be avoided as they go against expectation --> src/gen/debug.rs:985:9 | 985 | / impl crate::ExprStruct { 986 | | fn debug(&self, formatter: &mut fmt::Formatter, name: &str) -> fmt::Result { 987 | | let mut formatter = formatter.debug_struct(name); 988 | | formatter.field("attrs", &self.attrs); ... | 996 | | } 997 | | } | |_________^ | = help: move this `impl` block outside the of the current method `fmt` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = 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, they should be avoided as they go against expectation --> src/gen/debug.rs:1005:9 | 1005 | / impl crate::ExprTry { 1006 | | fn debug(&self, formatter: &mut fmt::Formatter, name: &str) -> fmt::Result { 1007 | | let mut formatter = formatter.debug_struct(name); 1008 | | formatter.field("attrs", &self.attrs); ... | 1012 | | } 1013 | | } | |_________^ | = help: move this `impl` block outside the of the current method `fmt` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = 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, they should be avoided as they go against expectation --> src/gen/debug.rs:1021:9 | 1021 | / impl crate::ExprTryBlock { 1022 | | fn debug(&self, formatter: &mut fmt::Formatter, name: &str) -> fmt::Result { 1023 | | let mut formatter = formatter.debug_struct(name); 1024 | | formatter.field("attrs", &self.attrs); ... | 1028 | | } 1029 | | } | |_________^ | = help: move this `impl` block outside the of the current method `fmt` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = 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, they should be avoided as they go against expectation --> src/gen/debug.rs:1037:9 | 1037 | / impl crate::ExprTuple { 1038 | | fn debug(&self, formatter: &mut fmt::Formatter, name: &str) -> fmt::Result { 1039 | | let mut formatter = formatter.debug_struct(name); 1040 | | formatter.field("attrs", &self.attrs); ... | 1044 | | } 1045 | | } | |_________^ | = help: move this `impl` block outside the of the current method `fmt` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = 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, they should be avoided as they go against expectation --> src/gen/debug.rs:1053:9 | 1053 | / impl crate::ExprUnary { 1054 | | fn debug(&self, formatter: &mut fmt::Formatter, name: &str) -> fmt::Result { 1055 | | let mut formatter = formatter.debug_struct(name); 1056 | | formatter.field("attrs", &self.attrs); ... | 1060 | | } 1061 | | } | |_________^ | = help: move this `impl` block outside the of the current method `fmt` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = 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, they should be avoided as they go against expectation --> src/gen/debug.rs:1069:9 | 1069 | / impl crate::ExprUnsafe { 1070 | | fn debug(&self, formatter: &mut fmt::Formatter, name: &str) -> fmt::Result { 1071 | | let mut formatter = formatter.debug_struct(name); 1072 | | formatter.field("attrs", &self.attrs); ... | 1076 | | } 1077 | | } | |_________^ | = help: move this `impl` block outside the of the current method `fmt` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = 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, they should be avoided as they go against expectation --> src/gen/debug.rs:1085:9 | 1085 | / impl crate::ExprWhile { 1086 | | fn debug(&self, formatter: &mut fmt::Formatter, name: &str) -> fmt::Result { 1087 | | let mut formatter = formatter.debug_struct(name); 1088 | | formatter.field("attrs", &self.attrs); ... | 1094 | | } 1095 | | } | |_________^ | = help: move this `impl` block outside the of the current method `fmt` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = 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, they should be avoided as they go against expectation --> src/gen/debug.rs:1103:9 | 1103 | / impl crate::ExprYield { 1104 | | fn debug(&self, formatter: &mut fmt::Formatter, name: &str) -> fmt::Result { 1105 | | let mut formatter = formatter.debug_struct(name); 1106 | | formatter.field("attrs", &self.attrs); ... | 1110 | | } 1111 | | } | |_________^ | = help: move this `impl` block outside the of the current method `fmt` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = 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, they should be avoided as they go against expectation --> src/gen/debug.rs:1179:9 | 1179 | / impl crate::FieldsNamed { 1180 | | fn debug(&self, formatter: &mut fmt::Formatter, name: &str) -> fmt::Result { 1181 | | let mut formatter = formatter.debug_struct(name); 1182 | | formatter.field("brace_token", &self.brace_token); ... | 1185 | | } 1186 | | } | |_________^ | = help: move this `impl` block outside the of the current method `fmt` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = 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, they should be avoided as they go against expectation --> src/gen/debug.rs:1194:9 | 1194 | / impl crate::FieldsUnnamed { 1195 | | fn debug(&self, formatter: &mut fmt::Formatter, name: &str) -> fmt::Result { 1196 | | let mut formatter = formatter.debug_struct(name); 1197 | | formatter.field("paren_token", &self.paren_token); ... | 1200 | | } 1201 | | } | |_________^ | = help: move this `impl` block outside the of the current method `fmt` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = 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, they should be avoided as they go against expectation --> src/gen/debug.rs:1257:9 | 1257 | / impl crate::ForeignItemFn { 1258 | | fn debug(&self, formatter: &mut fmt::Formatter, name: &str) -> fmt::Result { 1259 | | let mut formatter = formatter.debug_struct(name); 1260 | | formatter.field("attrs", &self.attrs); ... | 1265 | | } 1266 | | } | |_________^ | = help: move this `impl` block outside the of the current method `fmt` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = 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, they should be avoided as they go against expectation --> src/gen/debug.rs:1274:9 | 1274 | / impl crate::ForeignItemMacro { 1275 | | fn debug(&self, formatter: &mut fmt::Formatter, name: &str) -> fmt::Result { 1276 | | let mut formatter = formatter.debug_struct(name); 1277 | | formatter.field("attrs", &self.attrs); ... | 1281 | | } 1282 | | } | |_________^ | = help: move this `impl` block outside the of the current method `fmt` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = 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, they should be avoided as they go against expectation --> src/gen/debug.rs:1290:9 | 1290 | / impl crate::ForeignItemStatic { 1291 | | fn debug(&self, formatter: &mut fmt::Formatter, name: &str) -> fmt::Result { 1292 | | let mut formatter = formatter.debug_struct(name); 1293 | | formatter.field("attrs", &self.attrs); ... | 1302 | | } 1303 | | } | |_________^ | = help: move this `impl` block outside the of the current method `fmt` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = 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, they should be avoided as they go against expectation --> src/gen/debug.rs:1311:9 | 1311 | / impl crate::ForeignItemType { 1312 | | fn debug(&self, formatter: &mut fmt::Formatter, name: &str) -> fmt::Result { 1313 | | let mut formatter = formatter.debug_struct(name); 1314 | | formatter.field("attrs", &self.attrs); ... | 1321 | | } 1322 | | } | |_________^ | = help: move this `impl` block outside the of the current method `fmt` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = 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, they should be avoided as they go against expectation --> src/gen/debug.rs:1423:9 | 1423 | / impl crate::ImplItemConst { 1424 | | fn debug(&self, formatter: &mut fmt::Formatter, name: &str) -> fmt::Result { 1425 | | let mut formatter = formatter.debug_struct(name); 1426 | | formatter.field("attrs", &self.attrs); ... | 1438 | | } 1439 | | } | |_________^ | = help: move this `impl` block outside the of the current method `fmt` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = 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, they should be avoided as they go against expectation --> src/gen/debug.rs:1447:9 | 1447 | / impl crate::ImplItemFn { 1448 | | fn debug(&self, formatter: &mut fmt::Formatter, name: &str) -> fmt::Result { 1449 | | let mut formatter = formatter.debug_struct(name); 1450 | | formatter.field("attrs", &self.attrs); ... | 1456 | | } 1457 | | } | |_________^ | = help: move this `impl` block outside the of the current method `fmt` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = 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, they should be avoided as they go against expectation --> src/gen/debug.rs:1465:9 | 1465 | / impl crate::ImplItemMacro { 1466 | | fn debug(&self, formatter: &mut fmt::Formatter, name: &str) -> fmt::Result { 1467 | | let mut formatter = formatter.debug_struct(name); 1468 | | formatter.field("attrs", &self.attrs); ... | 1472 | | } 1473 | | } | |_________^ | = help: move this `impl` block outside the of the current method `fmt` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = 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, they should be avoided as they go against expectation --> src/gen/debug.rs:1481:9 | 1481 | / impl crate::ImplItemType { 1482 | | fn debug(&self, formatter: &mut fmt::Formatter, name: &str) -> fmt::Result { 1483 | | let mut formatter = formatter.debug_struct(name); 1484 | | formatter.field("attrs", &self.attrs); ... | 1494 | | } 1495 | | } | |_________^ | = help: move this `impl` block outside the of the current method `fmt` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = 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, they should be avoided as they go against expectation --> src/gen/debug.rs:1549:9 | 1549 | / impl crate::ItemConst { 1550 | | fn debug(&self, formatter: &mut fmt::Formatter, name: &str) -> fmt::Result { 1551 | | let mut formatter = formatter.debug_struct(name); 1552 | | formatter.field("attrs", &self.attrs); ... | 1563 | | } 1564 | | } | |_________^ | = help: move this `impl` block outside the of the current method `fmt` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = 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, they should be avoided as they go against expectation --> src/gen/debug.rs:1572:9 | 1572 | / impl crate::ItemEnum { 1573 | | fn debug(&self, formatter: &mut fmt::Formatter, name: &str) -> fmt::Result { 1574 | | let mut formatter = formatter.debug_struct(name); 1575 | | formatter.field("attrs", &self.attrs); ... | 1583 | | } 1584 | | } | |_________^ | …
…02-25) Extract the test trait impls out of the test function body. No user facing changes! ``` error: non-local `impl` definition, they should be avoided as they go against expectation --> avro/tests/validators.rs:42:5 | 42 | / impl SchemaNamespaceValidator for CustomValidator { 43 | | fn validate(&self, _ns: &str) -> AvroResult<()> { 44 | | Ok(()) 45 | | } 46 | | } | |_____^ | = help: move this `impl` block outside the of the current function `avro_3900_custom_validator_with_spec_invalid_names` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <rust-lang/rust#120363> ``` Signed-off-by: Martin Tzvetanov Grigorov <mgrigorov@apache.org>
…02-25) Extract the test trait impls out of the test function body. No user facing changes! ``` error: non-local `impl` definition, they should be avoided as they go against expectation --> avro/tests/validators.rs:42:5 | 42 | / impl SchemaNamespaceValidator for CustomValidator { 43 | | fn validate(&self, _ns: &str) -> AvroResult<()> { 44 | | Ok(()) 45 | | } 46 | | } | |_____^ | = help: move this `impl` block outside the of the current function `avro_3900_custom_validator_with_spec_invalid_names` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <rust-lang/rust#120363> ``` Signed-off-by: Martin Tzvetanov Grigorov <mgrigorov@apache.org> (cherry picked from commit 9e72af2)
``` error: non-local `impl` definition, they should be avoided as they go against expectation --> tests/pinned_drop.rs:140:17 | 140 | / impl S { 141 | | fn _f(self) -> Self { 142 | | self 143 | | } 144 | | } | |_________________^ | = help: move this `impl` block outside the of the current function `__drop_inner` and up 3 bodies = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <rust-lang/rust#120363> = note: `-D non-local-definitions` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(non_local_definitions)]` ```
``` error: non-local `impl` definition, they should be avoided as they go against expectation --> src/gen/ast_struct.rs:9:10 | 9 | #[derive(Serialize, Deserialize)] | ^^^^^^^^^ | = help: move this `impl` block outside the of the current constant `_IMPL_SERIALIZE_FOR_Abi` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <rust-lang/rust#120363> = note: the derive macro `Serialize` may come from an old version of the `serde_derive` crate, try updating your dependency with `cargo update -p serde_derive` = note: `-D non-local-definitions` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(non_local_definitions)]` = note: this error originates in the derive macro `Serialize` (in Nightly builds, run with -Z macro-backtrace for more info) ```
``` error: non-local `impl` definition, they should be avoided as they go against expectation --> src/gen/ast_struct.rs:9:10 | 9 | #[derive(Serialize, Deserialize)] | ^^^^^^^^^ | = help: move this `impl` block outside the of the current constant `_IMPL_SERIALIZE_FOR_Abi` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <rust-lang/rust#120363> = note: the derive macro `Serialize` may come from an old version of the `serde_derive` crate, try updating your dependency with `cargo update -p serde_derive` = note: `-D non-local-definitions` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(non_local_definitions)]` = note: this error originates in the derive macro `Serialize` (in Nightly builds, run with -Z macro-backtrace for more info) ```
They are treated the same for the purpose of this lint. They still encapsulate name resolution. |
@bjorn3 Hmm, in that case the current error message appears misleading. To me, it more or less explicitly says that they don't encapsulate name resolution. |
…orn3,Urgau Clarify that anonymous consts still do introduce a new scope See rust-lang#120363 (comment) This error message is misleading: it's trying to say that `const _ : () = ...` is a workaround for the lint, but by saying that anonymous constants are treated as being in the parent scope, it makes them appear useless for scope-hiding. They *are* useful for scope-hiding, they are simply treated as part of the parent scope when it comes to this lint.
Rollup merge of rust-lang#126652 - Manishearth:anon-const-scope, r=bjorn3,Urgau Clarify that anonymous consts still do introduce a new scope See rust-lang#120363 (comment) This error message is misleading: it's trying to say that `const _ : () = ...` is a workaround for the lint, but by saying that anonymous constants are treated as being in the parent scope, it makes them appear useless for scope-hiding. They *are* useful for scope-hiding, they are simply treated as part of the parent scope when it comes to this lint.
Is it intended that this lint fires in cases like these? trait Tr {}
struct Foo<T>(T);
fn foo() {
struct Bar;
impl Tr for Foo<Bar> {}
} This seems somewhat against the spirit of the lint. The lint also fires on fundamental types like trait Tr{}
fn foo() {
struct Bar;
impl Tr for Box<Bar> {}
} This seems like a bug or at least a wart. |
@jstarks: That is worth filing a dedicated issue about, if you would. |
OK, #126768. Feel free to clean up the title and such. |
I quickly scanned though the RFC rust-lang/rfcs#3373 comments and didn't see anything about macro generated runtime tables. Here's a minimal example of code that should not become a hard error: struct MyType;
// Heavily simplified version of a macro in my codebase.
macro_rules! my_macro {
($($fn_name:ident),*) => {
impl MyType {
pub fn $fn_name(&self) {
SomeHandler::$fn_name()
}
}
do_stuff(&some_type, stringify!($fn_name));
}
}
fn initialize(some_type: &MyType) {
my_macro!(
method1,
method2,
method_foo,
method_bar,
);
}
fn do_stuff(some_type: &MyType, method_name: &str) {
// Oversimplified, in real code the key and value might be different here.
some_type.insert_into_runtime_generated_table(method_name, method_name);
} In the above example we It calls the macro
To satisfy the lint the above could would need to be changed to: // BAD: Now we're using two macro invocations instead of one.
struct MyType;
macro_rules! implement {
($($fn_name:ident),*) => {
impl MyType {
pub fn $fn_name(&self) {
SomeHandler::$fn_name()
}
}
}
}
macro_rules! bind {
($($fn_name:ident),*) => {
do_stuff(&some_type, stringify!($fn_name));
}
}
implement! {
method1,
method2,
method_foo,
method_bar,
};
fn initialize(some_type: MyType) {
bind!(
method1,
method2,
method_foo,
method_bar,
);
}
fn do_stuff(some_type: &MyType, method_name: &str) {
// ...
} PatternThe pattern here is when you need to implement a method on a type AND also register that method name in some runtime generated table. Real WorldThis section is included to help prove that the above problem can be encountered in real-world code. It does not need to be read to understand the problem. For this reason I did not take the time to make this real-world example easy to understand / illustrate with simple code examples. A real world example of when something like this comes up is when using To expose a Rust type's methods to the wasm module you need to write code that essentially maps This way when the wasm module calls Closing ThoughtsRFC 3373 rust-lang/rfcs#3373 states the following as the motivation for the change:
In my case the human would be more confused if they had to check two macros to understand this pattern instead of one. My alternative would be to write a build script or some other form of codegen to generate this, but that would be more difficult for the human to find and maintain than a simple inlined macro. |
Can you generate the |
My real My development environment's syntax highlighting / other tools work better outside of macros than inside, so I'd prefer to avoid moving code into a macro to satisfy a lint. That said, I could have my macro generate the my_macro! {
// generated impl blocks here
fn initialize() {
initialize_inner_setup();
// ... generated code that inserts into a runtime table here ...
}
}
my_macro!();
#[inline]
fn initialize_inner_setup() {
// ... setup code that does not need to be in the macro ...
} The downside of extracting out the That said, when given a better name this hypothetical None of this is a big deal for my own codebase since this pattern only occurs once, just illustrating the trade-off. In practice it would be fine for me to generate the entire So generating everything in a single macro invocation would be okay in my case. |
Summary: Rust 1.79 produces a new warning. ```lang=text warning: non-local `impl` definition, they should be avoided as they go against expectation --> app/buck2_common/src/dice/file_ops/delegate.rs:170:5 | 170 | / impl Key for FileOpsKey { 171 | | type Value = buck2_error::Result<FileOpsValue>; 172 | | async fn compute( 173 | | &self, ... | 212 | | } 213 | | } | |_____^ | = help: move this `impl` block outside the of the current async fn `<unnameable>` and up 2 bodies = note: an `impl` definition is non-local if it is nested inside an item and may impact type checking outside of that item. This can be the case if neither the trait or the self type are at the same nesting level as the `impl` = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <rust-lang/rust#120363> = note: `#[warn(non_local_definitions)]` on by default ``` Reviewed By: JakobDegen Differential Revision: D59641307 fbshipit-source-id: 8993440bebd455ef9a81caadbb24d8b70ace05d0
…02-25) Extract the test trait impls out of the test function body. No user facing changes! ``` error: non-local `impl` definition, they should be avoided as they go against expectation --> avro/tests/validators.rs:42:5 | 42 | / impl SchemaNamespaceValidator for CustomValidator { 43 | | fn validate(&self, _ns: &str) -> AvroResult<()> { 44 | | Ok(()) 45 | | } 46 | | } | |_____^ | = help: move this `impl` block outside the of the current function `avro_3900_custom_validator_with_spec_invalid_names` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <rust-lang/rust#120363> ``` Signed-off-by: Martin Tzvetanov Grigorov <mgrigorov@apache.org>
…gain) warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item --> questions/014-trait-autoref.rs:20:13 | 11 | fn main() { | --------- move the `impl` block outside of this function `main` ... 20 | impl Trait for char { | ^^^^^-----^^^^^^^^^ | | | `Trait` is not local | = 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 <rust-lang/rust#120363> = note: `#[warn(non_local_definitions)]` on by default An earlier iteration of this warning previously appeared in 1.79-nightly but was reverted.
```text warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item --> main/utility/macros.rs:148:13 | 147 | const $const_name : () = { | ---------------------- move the `impl` block outside of this associated constant `_syscall_logger_waitid` 148 | impl crate::utility::macros::SyscallLogger { | ^^^^^------------------------------------- | | | `SyscallLogger` is not local | ::: main/host/syscall/handler/wait.rs:232:5 | 232 | / log_syscall!( 233 | | waitid, 234 | | /* rv */ kernel_pid_t, 235 | | /* which */ c_int, ... | 239 | | /* uru */ *const std::ffi::c_void, 240 | | ); | |_____- in this macro invocation | = note: the macro `log_syscall` defines the non-local `impl`, and may need to be changed = 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 <rust-lang/rust#120363> = note: this warning originates in the macro `log_syscall` (in Nightly builds, run with -Z macro-backtrace for more info) ```
```text warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item --> main/utility/macros.rs:148:13 | 147 | const $const_name : () = { | ---------------------- move the `impl` block outside of this associated constant `_syscall_logger_waitid` 148 | impl crate::utility::macros::SyscallLogger { | ^^^^^------------------------------------- | | | `SyscallLogger` is not local | ::: main/host/syscall/handler/wait.rs:232:5 | 232 | / log_syscall!( 233 | | waitid, 234 | | /* rv */ kernel_pid_t, 235 | | /* which */ c_int, ... | 239 | | /* uru */ *const std::ffi::c_void, 240 | | ); | |_____- in this macro invocation | = note: the macro `log_syscall` defines the non-local `impl`, and may need to be changed = 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 <rust-lang/rust#120363> = note: this warning originates in the macro `log_syscall` (in Nightly builds, run with -Z macro-backtrace for more info) ```
```text warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item --> main/utility/macros.rs:148:13 | 147 | const $const_name : () = { | ---------------------- move the `impl` block outside of this associated constant `_syscall_logger_waitid` 148 | impl crate::utility::macros::SyscallLogger { | ^^^^^------------------------------------- | | | `SyscallLogger` is not local | ::: main/host/syscall/handler/wait.rs:232:5 | 232 | / log_syscall!( 233 | | waitid, 234 | | /* rv */ kernel_pid_t, 235 | | /* which */ c_int, ... | 239 | | /* uru */ *const std::ffi::c_void, 240 | | ); | |_____- in this macro invocation | = note: the macro `log_syscall` defines the non-local `impl`, and may need to be changed = 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 <rust-lang/rust#120363> = note: this warning originates in the macro `log_syscall` (in Nightly builds, run with -Z macro-backtrace for more info) ```
We didn't make a decision to increase the severity of this lint in Rust 2024, so this is not a Rust 2024 edition item. We could always decide to bump the severity of this lint in a future edition, of course, just as we could for any other lint. But we probably don't need to hold the tracking issue open for that. So, seeing as how everything else seems done here in terms of implementing RFC 3373, let's go ahead and mark this as completed. |
…r=compiler-errors Remove deprecation note in the `non_local_definitions` lint This PR removes the edition deprecation note emitted by the `non_local_definitions` lint. Specifically this part: ``` = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <rust-lang#120363> ``` because it [didn't make the cut](rust-lang#120363 (comment)) for the 2024 edition. `@rustbot` label +L-non_local_definitions
Rollup merge of rust-lang#131565 - Urgau:non_local_def-rm-deprecate, r=compiler-errors Remove deprecation note in the `non_local_definitions` lint This PR removes the edition deprecation note emitted by the `non_local_definitions` lint. Specifically this part: ``` = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <rust-lang#120363> ``` because it [didn't make the cut](rust-lang#120363 (comment)) for the 2024 edition. `@rustbot` label +L-non_local_definitions
…r-errors Remove deprecation note in the `non_local_definitions` lint This PR removes the edition deprecation note emitted by the `non_local_definitions` lint. Specifically this part: ``` = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <rust-lang/rust#120363> ``` because it [didn't make the cut](rust-lang/rust#120363 (comment)) for the 2024 edition. `@rustbot` label +L-non_local_definitions
This is a tracking issue for the RFC 3373: Avoid non-local definitions in functions (rust-lang/rfcs#3373).
Summary
Add a warn-by-default lint for items inside functions or expressions that implement methods or traits that are visible outside the function or expression.
About tracking issues
Tracking issues are used to record the overall progress of implementation. They are also used as hubs connecting to other relevant issues, e.g., bugs or open design questions. A tracking issue is however not meant for large scale discussion, questions, or bug reports about a feature. Instead, open a dedicated issue for the specific matter and add the relevant feature gate label.
Steps
Stabilization PR (see instructions on rustc-dev-guide)Unresolved questions
const
items as well, or would that produce unwanted warnings?const _: () = { /* .. */ }
since the pattern is widely used in the ecosystem, includingserde_derive
.Related
non_local_definitions
common issues: impl for&Local
,From<Local> for Global
, ... #121621 (comment)non-local-definitions
lint #124396non_local_definitions
lint fires forimpl Trait for NonLocalType<SomeLocalType>
, probably shouldn't #126768non_local_definitions
lint to allow-by-default #127015non_local_definitions
lint to only use a syntactic heuristic #127117The text was updated successfully, but these errors were encountered: