{
"$type": "site.standard.document",
"bskyPostRef": {
"cid": "bafyreif2copjvz5c5atuelynvpgo3whuivmrgm5ehm7vdbpeqlmxyz3xpa",
"uri": "at://did:plc:ivbknywyskln22er3nkssdhl/app.bsky.feed.post/3mj4cqzhehsk2"
},
"path": "/t/change-error-message-of-a-failing-assert-eq/24118?page=2#post_27",
"publishedAt": "2026-04-09T07:41:11.000Z",
"site": "https://internals.rust-lang.org",
"textContent": "That could reveal secret information, so it's not an option for the existing `assert_eq!` macro. Consider an application using `assert_eq!(expectedPassword, providedPassword)`...\n\nIt would also require trait based specialization, to support both types that implement `Debug` and those that don't. So it can't be implemented at the moment.\n\n* * *\n\nI think assertions in production code, and assertions in tests are very different beasts, and it's not possible for one macro to be ideal for both cases. The current implementation seems fine for production assertions, and usable but not okay for test assertions.\n\nMost of the suggestions (pattern matching, debug printing, (re)named arguments) in this thread are for the tests use-case, but those deserve their own macros (first in crates, later perhaps in std).",
"title": "Change error message of a failing `assert_eq!`"
}