Optional features are part of the crate — the project should say so
I prefer to use cargo hack test --feature-powerset (with --include-features and --exclude-features as needed, e.g. for platform-specific or platform-incompatible features).
I also overrode rust-analyzer.check.overrideCommand in .vscode/settings.json to a program that makes (and caches) several calls to cargo hack clippy --feature-powerset --depth 1. The result is that all errors, from any tested cfg combination, are overlaid. However, it's not enough for go-to-def or type hints... cfg-d out code still gets grayed out as normal.
I think the ideal would be for rust-analyzer to support overlaying results from multiple sets of cfgs, targets, and so on without having to use third-party workarounds. (I fear the cost in RAM usage might be high, but then again, my check.overrideCommand does a pretty bad job of caching stuff and still works fine.)
Discussion in the ATmosphere