Implied bounds are a serious and underappreciated SemVer hazard: - They are public API, but not obvious nor written down explicitly in the location where they are public API. - They are "infectious", behaving similarly to auto-traits, and therefore able to cause a "spooky action at a distance" style of breakage. Consider the following example: ```rust pub fn example<'a, T>(value: Wrapper<'a, T>) {} pub struct Wrapper<'a, T>(Inner<'a, T>); struct Inner<'a, T>(&'a i64, T); impl<'a, T> Wrapper<'a, T> { ... } impl<'a, T> Inner<'a, T> { ... } ``` Noting that `Inner` is a private type, let's say it sees the following change: ```diff - struct Inner<'a, T>(&'a i64, T); + struct Inner<'a, T: 'a>(&'a T); ``` The new `T: 'a` bound propagates in "infectious" fashion from `Inner` to `Wrapper` to `example`, causing breaking changes in the public API of both `Wrapper` and `example`. Today, neither the HTML nor the JSON outputs of rustdoc show implicit bounds. Despite the breaking change, the rustdoc HTML and JSON outputs will be identical before and after this change, making it completely invisible to both consumers of the API and the maintainers who wish to not needlessly break their users. The issue is not specific to "outlives" bounds — it also appears with `T: ?Sized` bounds and (I believe) any kind of trait or lifetime bound that is valid in Rust. This issue requests information on _all_ kinds of implicit bounds. `cargo-semver-checks` would like to be able to analyze changes to bounds and flag SemVer hazards. The lack of implicit bounds data means that we currently cannot do so in either direction: - We cannot see implicit bounds, so SemVer breakage caused by implicit bounds is invisible to us. - We cannot report breakage due to additions of an explicit bound, because the bound may have already been implied. - We cannot claim that the removal of an explicit bound in trait associated items is breaking, since (I believe) the bound may still be implied. Exposing rustc's implicit bounds data in rustdoc JSON would resolve this problem for `cargo-semver-checks`. Unrelatedly, as a user of rustdoc HTML, I'd also love to see implicit bounds in HTML as well. cc @aDotInTheVoid @rustbot label A-rustdoc-json