#[derive(Builder, Debug)]
struct Orange {
a: String,
b: String,
}
fn main() {
let orange = Orange::builder()
.set_a("xxx".into())
.set_b(panic!())
.build();
dbg!(orange);
}
cargo +nightly miri run
The following memory was leaked: alloc1014 (Rust heap, size: 3, align: 1) {
78 78 78 │ xxx
}
This can be addressed by using a scope guard.