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 ? So that once someone depends on the crate and pull it from 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.


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 or otherwise.

1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.