{
"$type": "site.standard.document",
"bskyPostRef": {
"cid": "bafyreigi3n6abiayxpdcwl56ohoc6uk5a57qsowgjtyix44a6kuohn3cuu",
"uri": "at://did:plc:ivbknywyskln22er3nkssdhl/app.bsky.feed.post/3midet4c62po2"
},
"path": "/t/change-error-message-of-a-failing-assert-eq/24118#post_14",
"publishedAt": "2026-03-31T02:38:14.000Z",
"site": "https://internals.rust-lang.org",
"textContent": "Changing the message will not be an effective way of eliminating inconsistency in the ecosystem: most people will not notice, so we'll just be making code worse.\n\nIf this is something that could be linted on, perhaps, but otherwise this is not a good idea. There is clearly ambiguity in the ecosystem, you cannot just force consensus through a behavior change.\n\nFurthermore, not every assertion case has a clear expected/actual, sometimes the thing is indeed just \"are these two things the same\".\n\nA better proposal that helps eliminate confusion would be to add `expected=` and `actual=` disambiguators to the macro, e.g. `assert_eq!(expected = foo, actual = bar)`, which change the displayed error message. I'm not sure if it pulls its weight (it feels verbose to me), but it would allow for folks to opt in to expected/actual messaging. I certainly have times where I wish the assertion error message told me which was the expected value.",
"title": "Change error message of a failing `assert_eq!`"
}