-
Notifications
You must be signed in to change notification settings - Fork 27
Open
Description
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 }
the structure.each_variant(...)
and structure.each(...)
produces code that looks like
match self {
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 &
.
match self {
&Foo { x: ref __binding_0 } => { ... }
}
Cheers,
MrFoxPro
Metadata
Metadata
Assignees
Labels
No labels