Is [patch.crates-io] retained while publishing a crate?

When using a [patch.crates-io] within an actual crate - mainly for the PR CI build - retained when publishing to crates.io ? So that once someone depends on the crate and pull it from crates.io this will also use the patch section?

I hope that this will be filtered out as part of the publishing but would like confirmation before actually publishing.

Thx in advance.

No, patches are only applied from the workspace cargo is executed in.

1 Like

You can check locally with cargo package, then target/package/ will contain the packaged sources with Cargo.toml.orig and the modified Cargo.toml.

2 Likes

To be clear, even if the [patch] section is still present in Cargo.toml, it will be ignored when the crate is used as a dependency, whether through crates.io or otherwise.

1 Like