zozbot234 3 days ago

How does foo/bin use both when foo/a/* and foo/b/ use ABI-incompatible versions of stdlib types, perhaps in their public interfaces? This can easily lead to breakage in interop across foo/a/* and foo/b/ .

2
tomjakubowski 1 day ago

> ABI-incompatible versions of stdlib types

libc++ and glibc++ both break ABI less frequently than new versions of C++ come out. As far as I'm aware, libc++ has never released a breaking change to its ABI.

layer8 2 days ago

How does Rust do it?

steveklabnik 2 days ago

There’s only ever one instance of the standard library when a program is compiled, so an and b cannot depend on different versions of it.

For normal libraries, an and b could depend on different versions, so this could be a problem. The name mangling scheme allows for a “disambiguator” to differentiate the two, I believe that the version is used here but the documentation for it does not say if there’s more than that.

GolDDranks 2 days ago

By linking both and not allowing mixing types, i.e. it considers types from a totally unrelated with types from b.

Also, Rust compiles the whole world at once, so any ABI breakage from mixing code from different compiler versions doesn't happen. (Editions are different thing from compiler versions, a single version of the compiler supports multiple editions.)

steveklabnik 2 days ago

Rust does not compile the whole world at once. Each crate is compiled separately, and then they’re all linked together at the end.

GolDDranks 4 hours ago

Yeah, I know, but I mean that it's normal to link together crates compiled with the same compiler, unlike with C, where ABIs are stabler and binary dependencies are more common.