Type inference breakage in 1.80 has not been handled well

There's maybe a space here to pull language-version-dependent features into cargo+rustc proper?

I'm imagining something like in Cargo.toml:

[bikeshed-rustc-version-dependent-features]
uses_const_generics = "1.51"

And then being able to #[cfg(feature = "uses_const_generics")] in rust code.

This makes rustc-version-dependent features more declarative (avoiding the need for build scripts, and perhaps even the rustversion crate at all, and allowing the resolver to give much better and earlier errors about unsupported versions), and gives cargo the knowledge to configure rustc with what trait universes should be in scope based on declarative feature data rather than requiring a hard-coded max-known-rust-version.

(The UI surface of this feature, and whether it needs an opt-in/out because people may still be using rustversion or similar, are very open to discussion, but the core idea may be worth considering)

1 Like