dev-dependencies section doesn't mean "only in non-release build" - it means "only for building the tests/examples/benchmarks". They must be resolved anyway.
I realize that but my point is why cargo resolves unused dependencies? I would expect it resolves rstest during cargo test but cargo build does not event attempt to build rstest. I can drop it from dev-dependencies and cargo build will pass just fine.
Before building anything Cargo makes a lock file with all dependencies for all features on all platforms. If it can't make the lock file, it can't build.
This is a leftover from original Cargo logic, now known as resolver = "1" that did not see any difference between dev and normal dependencies and resolved them all together. Now resolver = "2" can look at only necessary dependencies, but the lock file is still for everything all at once.
I haven't heard of such plans. It will probably stay, because lock files are supposed to guarantee you can always build the project, and excluding dev builds from this guarantee weakens this promise. The lock files are also kept long term in projects, so need to have a stable format.
Perhaps Cargo could be persuaded to add a build mode or dependency resolution mode that skips the lock file and forces it to ignore broken dependencies.