Project fails to compile when canon-json is used with serde_json with raw_value and arbitrary_precision features enabled. Here is how to replicate the issue:
The project's Cargo.toml looks like
[package]
name = "foo"
version = "0.1.0"
edition = "2024"
[dependencies]
canon-json = { git = "https://github.com/bootc-dev/canon-json-rs.git" }
serde_json = { version = "1.0.149", features = ["arbitrary_precision", "raw_value"] }
serde = { version = "1.0.224", features = ["derive"] }
main.rs contains:
use canon_json::CanonJsonSerialize;
use serde::Serialize;
#[derive(Serialize, Debug)]
struct Foo {
a: String,
}
fn main() {
let f = Foo {
a: "foo".to_owned(),
};
println!("{}", f.to_canon_json_string().unwrap());
}
While running cargo build, I get the following error:
error[E0275]: overflow evaluating the requirement `&mut Vec<u8>: std::io::Write`
|
= help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`foo`)
= note: required for `&mut &mut Vec<u8>` to implement `std::io::Write`
= note: 127 redundant requirements hidden
= note: required for `WriterTarget<'_, &mut WriterTarget<'_, &mut WriterTarget<'_, &mut WriterTarget<'_, &mut ...>>>>` to implement `std::io::Write`
= note: required for `&mut Serializer<WriterTarget<'_, &mut WriterTarget<'_, &mut WriterTarget<'_, &mut ...>>>, ...>` to implement `Serializer`
Project fails to compile when
canon-jsonis used withserde_jsonwithraw_valueandarbitrary_precisionfeatures enabled. Here is how to replicate the issue:The project's Cargo.toml looks like
main.rs contains:
While running
cargo build, I get the following error: