Closed
Description
cargo script
compatible example:
//! ```cargo
//! [dependencies]
//! serde = "1.0.79"
//! serde_json = { version = "1.0.32", features = ["raw_value"] }
//! serde_derive = "1.0.79"
//! ```
#[macro_use] extern crate serde_derive;
extern crate serde;
extern crate serde_json;
#[derive(Debug, Deserialize, Serialize)]
struct FooNewtype<T>(T);
#[derive(Debug, Deserialize, Serialize)]
#[serde(untagged)]
enum FooEnum<T> {
Single(T)
}
fn main() {
// works
let val: FooNewtype<Box<serde_json::value::RawValue>> = serde_json::from_str("42").unwrap();
println!("{:?}", val);
// thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Error("data did not match any variant of untagged enum FooEnum", line: 0, column: 0)', libcore/result.rs:945:5
let val: FooEnum<Box<serde_json::value::RawValue>> = serde_json::from_str("42").unwrap();
println!("{:?}", val);
}
I haven't figured out what's causing this yet.