We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Encode
error[E0425]: cannot find value `field_0` in this scope --> bug/src/lib.rs:4:29 | 1 | / macro_rules! dv { 2 | | ($($t:item),+) => { 3 | | $( 4 | | #[derive(Clone, bincode::Encode, bincode::Decode)] | | ^^^^^^^^^^^^^^^ | | | | | not found in this scope | | in this derive macro expansion (#2) ... | 7 | | } 8 | | } | |_- in this expansion of `dv!` (#1) ... 11 | / dv! { 12 | | pub struct Foo {}, 13 | | pub enum Bar { 14 | | A(Foo), 15 | | B, 16 | | } 17 | | } | |_- in this macro invocation (#1) | ::: /home/lxb/.cargo/registry/src/github.com-1ecc6299db9ec823/bincode_derive-2.0.0-rc.1/src/lib.rs:9:1 | 9 | pub fn derive_encode(input: proc_macro::TokenStream) -> proc_macro::TokenStream { | ------------------------------------------------------------------------------- in this expansion of `#[derive(bincode::Encode)]` (#2)
macro_rules! dv { ($($t:item),+) => { $( #[derive(Clone, bincode::Encode, bincode::Decode)] $t )+ } } // Doesn't compile dv! { pub struct Foo {}, pub enum Bar { A(Foo), B, } } // Compiles #[derive(Clone, bincode::Encode, bincode::Decode)] pub struct Foo2 {} #[derive(Clone, bincode::Encode, bincode::Decode)] pub enum Bar2 { A(Foo2), B, }
[package] name = "bug" version = "0.1.0" edition = "2021" [dependencies] bincode = { version = "2.0.0-rc.1", default-features = false, features = ["derive"] }
This doesn't seem to happen with Decode
Decode
The text was updated successfully, but these errors were encountered:
This looks like a macro hygiene thing, and I don't see an easy fix.
Sorry, something went wrong.
No branches or pull requests
This doesn't seem to happen with
Decode
The text was updated successfully, but these errors were encountered: