You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Great crate, thanks ! I'm working with a nightly compiler, and I noticed the crate relies on implicit default binding modes, which has changed in Rust 2024 (the compiler error is unclear, see rust-lang/rust#136456 ).
Actual behavior :
For a struct Foo { x: u32 } the structure.each_variant(...) and structure.each(...) produces code that looks like
matchself{Foo{x:ref __binding_0 } => { ...}}
Resulting in the compiler error like :
error: this pattern relies on behavior which may change in edition 2024
|
4 | #[derive(SomeDeriveMacro)]
| ^
| |
| default binding mode is reset within expansion
| default binding mode is reset within expansion
|
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/match-ergonomics.html>
= note: this error originates in the derive macro `derive_debug::Debug` (in Nightly builds, run with -Z macro-backtrace for more info)
error: this pattern relies on behavior which may change in edition 2024
|
109 | Foo { x: ref __binding_0 } => { Ok(()) }
| ^^^ cannot override to bind by-reference when that is the implicit default
|
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/match-ergonomics.html>
help: make the implied reference patterns explicit
Expected behavior :
Just need to add the &.
matchself{&Foo{x:ref __binding_0 } => { ...}}
Cheers,
The text was updated successfully, but these errors were encountered:
You can also change self to *self in the match expression. With this I was able to make the code compile in 2024 edition without any changes to synstructure.
Hello there,
Great crate, thanks ! I'm working with a nightly compiler, and I noticed the crate relies on implicit default binding modes, which has changed in Rust 2024 (the compiler error is unclear, see rust-lang/rust#136456 ).
Actual behavior :
For a
struct Foo { x: u32 }
thestructure.each_variant(...)
andstructure.each(...)
produces code that looks likeResulting in the compiler error like :
Expected behavior :
Just need to add the
&
.Cheers,
The text was updated successfully, but these errors were encountered: