Closed
Description
use std::fmt;
struct ErrorFmt;
impl fmt::Debug for ErrorFmt {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
Err(fmt::Error)
}
}
struct A {
field: ErrorFmt,
}
impl fmt::Debug for A {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.debug_map()
.entry(&"field", &ErrorFmt)
.finish()
}
}
fn main() {
println!("{:?}", A { field: ErrorFmt });
}
thread 'main' panicked at 'attempted to finish a map with a partial entry', src/libcore/fmt/builders.rs:924:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
I think the assert should just be removed so that the error gets propagated up?