Earlier quoted context omitted.
I’m confused. If you rely on a feature introduced in X.y.z why would you specify X.y.0 to begin with (and not just X.y.z)? In practice, usual rust projects that have not put a ton of work into their dependencies encode X.y.z in Cargo.toml matching the current release at the time they developed the system. So you get at worst an unnecessarily higher version requirement but never a lower one. Moreover, rust semver woul…
It's easy to accidentally ship a minimum version requirement that is out of date when you also consistently use lock files pinned to newer versions. The code may silently depend on something introduced in a newer version pulled in by the lock file.
Can a Rust binary use incompatible versions of the same library?
31–40 of 89 posts
Re: Can a Rust binary use incompatible versions of the same library?
#32For example, the compiler error in this example:
note: perhaps two different versions of crate `smithay_client_toolkit` are being used?
Re: Can a Rust binary use incompatible versions of the same library?
#33Earlier quoted context omitted.
Go got this right: you want an incompatible version, you have to use a different import path. Then you can only pick one version (which is deterministically the lowest possible version) for a certain import path, not a hundred different versions. Also forces people to actually take backwards compatibility seriously.
But surely you can still run into the same issue: I import a@1 and b@1 a@1 transitively depends on c@1 b@1 transitively depends on c@2 Even with different import paths, I still have two different versions of c in my codebase. It'll just be that one of them is imported as "c" and the other will be imported as "c/v2" - but you don't need to worry about that, because that's happening in transitive dependencies that you'…
Re: Can a Rust binary use incompatible versions of the same library?
#34Earlier quoted context omitted.
Go got this right: you want an incompatible version, you have to use a different import path. Then you can only pick one version (which is deterministically the lowest possible version) for a certain import path, not a hundred different versions. Also forces people to actually take backwards compatibility seriously.
No one asked about Go here. And no, it didn’t, it’s the same PITA as in Java or maybe even worse because there are no workarounds like classloading or shading. You have no control over the transitive dependencies. The only thing you can do if there’s a conflict is asking the author to fix one of the conflicting libraries.
Re: Can a Rust binary use incompatible versions of the same library?
#35So both versions of log crate manage their own internal states within the same process? Would this lead to surprising results?
Their internal states in Rust are also namespaced, so two incompatible crates in the same process won't observe each others symbols. If they access external resources that are not namespaced though, that could be a problem.
Re: Can a Rust binary use incompatible versions of the same library?
#36Re: Can a Rust binary use incompatible versions of the same library?
#37Re: Can a Rust binary use incompatible versions of the same library?
#38Earlier quoted context omitted.
Go got this right: you want an incompatible version, you have to use a different import path. Then you can only pick one version (which is deterministically the lowest possible version) for a certain import path, not a hundred different versions. Also forces people to actually take backwards compatibility seriously.
Backwards compatibility is more difficult in Rust for many reasons. For example, you can't add a new item to an enum without creating missing-case errors everywhere it is used.
Re: Can a Rust binary use incompatible versions of the same library?
#39Earlier quoted context omitted.
Their internal states in Rust are also namespaced, so two incompatible crates in the same process won't observe each others symbols. If they access external resources that are not namespaced though, that could be a problem.
How would that work for malloc? How can you have two different functions manage the same heap?
The free() function frees the memory space pointed to by ptr, which must have been returned by a previous call to malloc(), calloc() or realloc(). Otherwise, or if free(ptr) has already been called before, undefined behavior occurs. If ptr is NULL, no operation is performed.