A follow-up to D47496.
This would warn the developer on the very common bug that consists in writing, eg., State->set<Trait>(Key, Value) instead of State = State->set<Trait>(Key, Value). Because in the first snippet the updated State object is discarded while the original object remains unchanged (because it's, well, immutable), which isn't what you ever want to do.
LLVM_NODISCARD is essentially warn_unused_result.
For now no such bugs were found in the analyzer, but i made these mistakes myself knowingly and i see many such bugs during code review.