cargo::ops::cargo_compile

# Function remove_duplicate_doc

Source

    fn remove_duplicate_doc(
        build_config: &BuildConfig,
        root_units: &[Unit],
        unit_graph: &mut UnitGraph,
    )

Expand description

Removes duplicate `CompileMode::Doc` units that would cause problems with filename collisions.

Rustdoc only separates units by crate name in the file directory structure. If any two units with the same crate name exist, this would cause a filename collision, causing different rustdoc invocations to stomp on one another’s files.

Unfortunately this does not remove all duplicates, as some of them are either user error, or difficult to remove. Cases that I can think of:

- Same target name in different packages. See the `collision_doc` test.
- Different sources. See `collision_doc_sources` test.

Ideally this would not be necessary.