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
Hi, first of all congratulations on the launch of bincode v2, I really like the changes.
During the migration to v2, I noticed the following minor issue, and I suspect that this is not intended behaviour:
use anyhow::Ok;#[derive(Debug,PartialEq, bincode::Encode, bincode::Decode)]structFoo(String);fnmain(){let val = Foo("Bar".to_string());let config = bincode::config::standard();let val_encoded = bincode::encode_to_vec(&val, config).unwrap();let(val_decoded, _) = bincode::decode_from_slice(&val_encoded, config).unwrap();assert_eq!(val, val_decoded);}
Observed
Compiling the project fails because the derived Encode and Decode implementations return Ok, which is bound to anyhow::Ok due to the use declaration in L1.
Error
error[E0308]: mismatched types
--> src/main.rs:3:28
|
3 | #[derive(Debug, PartialEq, bincode::Encode, bincode::Decode)]
| ^^^^^^^^^^^^^^^
| |
| expected `Result<(), EncodeError>`, found `Result<(), Error>`
| expected `Result<(), EncodeError>` because of return type
|
= note: expected enum `Result<_, EncodeError>`
found enum `Result<_, anyhow::Error>`
= note: this error originates in the derive macro `bincode::Encode` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0308]: mismatched types
--> src/main.rs:3:45
|
3 | #[derive(Debug, PartialEq, bincode::Encode, bincode::Decode)]
| ^^^^^^^^^^^^^^^
| |
| expected `Result<Foo, DecodeError>`, found `Result<Foo, Error>`
| expected `Result<Foo, DecodeError>` because of return type
|
= note: expected enum `Result<_, DecodeError>`
found enum `Result<_, anyhow::Error>`
= note: this error originates in the derive macro `bincode::Decode` (in Nightly builds, run with -Z macro-backtrace for more info)
Expected
The project should compile.
The text was updated successfully, but these errors were encountered:
Hi, first of all congratulations on the launch of bincode v2, I really like the changes.
During the migration to v2, I noticed the following minor issue, and I suspect that this is not intended behaviour:
Observed
Compiling the project fails because the derived
Encode
andDecode
implementations returnOk
, which is bound toanyhow::Ok
due to the use declaration in L1.Error
Expected
The project should compile.
The text was updated successfully, but these errors were encountered: