a exports struct
S, and crates
c both depend on
a and re-export
c were built with the same version of
a, will a crate
d that depends on both
c::S as distinct types or the same type?
It will be treated as the same type.
This has interesting consequences regarding semantic versioning. Re-exporting types or traits from another crate (or implementing traits from another crate) conventionally makes this other crate a “public dependency”. So here,
a would be a public dependency of
d also depends on
a, then all three types: the
a::S and the two re-exports
c::C, will all be the same type. If
a gets a major version update (not using the semver trick), then
c cannot update their dependency to the newer version either without introducing a new major version, otherwise it would break users relying on the fact that the type from the specific version of
a and the re-export from
c are the same.
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.