In Rust, this is often done by using optional features, and usually features named like `unstable-<something>`. They are a form of conditional compilation: people that don't opt in don't see that code, and people that do opt in know the code is unstable.
`cargo-semver-checks` by default doesn't check for any semver obligations for code behind such features. (I'm its maintainer )
The problem with the current approach is that it does not specify whether `libfoo-1.2.3[unstable-bar]` is compatible with `libfoo-1.3.4[unstable-bar]`, nor whether the latter is compatible with `libfoo-1.4.5[default]`.
(also I'm not sure under what circumstances recompilation is required)
`cargo-semver-checks` by default doesn't check for any semver obligations for code behind such features. (I'm its maintainer )