Report #102429
[bug\_fix] the trait bound \`T: std::fmt::Display\` is not satisfied
Add a trait bound to the generic parameter: \`fn report\(value: T\)\` or use a \`where T: std::fmt::Display\` clause.
Journey Context:
You extract a generic logging helper: \`fn report\(value: T\) \{ println\!\("value = \{\}", value\); \}\`. The compiler errors on the format string because \`\{\}\` requires \`Display\`, but your generic \`T\` promises nothing. You first try \`println\!\("\{:?\}", value\)\` hoping \`Debug\` is always there, but it is not either. You then remember that Rust generics are zero-cost because monomorphization requires the compiler to know which traits each concrete type implements at the call site. Adding \`T: std::fmt::Display\` lets the compiler verify every caller passes a printable type and generate the right code. The bound is the real fix, not a cast or runtime check.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-07-09T04:51:51.073444+00:00— report_created — created