Cargo test when invoking rustdoc (for the documentation tests) ignores the rustc-link-lib set from the build script

When linking a library statically (stdc++) with a library crate, we need to add this:


However, if specified like this, the unit tests work fine, but the doc-tests fail due to being unable to locate many-many symbols from the stdc++ within the crate library.

It can be fixed by linking the whole archive:


But this seems to be a little redundant.

The question is if this is intended. If not, I wonder how one is assumed to be correctly linking then to avoid the problem for the doc-tests?