{
"$type": "site.standard.document",
"bskyPostRef": {
"cid": "bafyreihbqfvangmpv6jpgkwunj3b7y66axl6grhroiahvdkmxd2cirghse",
"uri": "at://did:plc:ivbknywyskln22er3nkssdhl/app.bsky.feed.post/3mif2l6of72w2"
},
"path": "/t/change-error-message-of-a-failing-assert-eq/24118#post_16",
"publishedAt": "2026-03-31T09:09:32.000Z",
"site": "https://internals.rust-lang.org",
"tags": [
"[1]",
"↩︎"
],
"textContent": "I'd find it much more valuable if the output would highlight the actual difference. When asserting equality between structs (especially large or nested ones) you often get two blobs of `std::fmt::Debug` outputs you have to look through to find a (sometimes) one character difference.\n\nNot sure on the feasability of that though [1], but even diff on the output text + color highlighting would be very useful in that situation. Example (inspired by Wordle):\n\n * Red for sections that don't occur in the Debug output of the other side\n * Optional: Orange for (larger) sections that are in the other side but not in the same place\n * White for matching sections (same place/order)\n\n\n\n* * *\n\n 1. Especially when order does not matter for equality like with HashMap. ↩︎\n\n\n",
"title": "Change error message of a failing `assert_eq!`"
}