)]}'
{
  "commit": "e8e4541ff19649d95afab52fdde2c2eaa6829965",
  "tree": "a67e927b06d2319db7f220287a2b5d6a54e6e784",
  "parents": [
    "9620eae30ab7614dcb72d44c4ce1dac497f6ae18",
    "a7590138a73e246a0b219d8ae806cf7753febf1a"
  ],
  "author": {
    "name": "bors",
    "email": "bors@rust-lang.org",
    "time": "Wed Apr 15 18:09:11 2026 +0000"
  },
  "committer": {
    "name": "bors",
    "email": "bors@rust-lang.org",
    "time": "Wed Apr 15 18:09:11 2026 +0000"
  },
  "message": "Auto merge of #139087 - beetrees:impl-from-f16-for-f32, r\u003djackh726\n\nFallback `{float}` to `f32` when `f32: From\u003c{float}\u003e` and add `impl From\u003cf16\u003e for f32`\n\n\r\n\r\nCurrently, the following code compiles:\r\n```rust\r\nfn foo\u003cT: Into\u003cf32\u003e\u003e(_: T) {}\r\n\r\nfn main() {\r\n    foo(1.0);\r\n}\r\n```\r\n\r\nThis is because the only `From\u003c{float}\u003e` impl for `f32` is currently `From\u003cf32\u003e`. However, once `impl From\u003cf16\u003e for f32` is added this is no longer the case. This would cause the float literal to fallback to `f64`, subsequently causing a type error as `f32` does not implement `From\u003cf64\u003e`. While this kind of change to type inference isn\u0027t technically a breaking change according to Rust\u0027s breaking change policy, the previous attempt to add `impl From\u003cf16\u003e for f32` was removed rust-lang/rust#123830 due to the large number of crates affected (by my count, there were root regressions in 42 crates and 52 GitHub repos, not including duplicates). This PR solves this problem by using `f32` as the fallback type for `{float}` when there is a trait predicate of `f32: From\u003c{float}\u003e`. This allows adding `impl From\u003cf16\u003e for f32` without affecting the code that currently compiles (such as the example above; this PR shouldn\u0027t affect what is possible on stable).\r\n\r\nThis PR also allows adding a future-incompatibility warning for the fallback to `f32` (currently implemented in the third commit) if the lang team wants one (allowing the `f32` fallback to be removed in the future); alternatively this could be expanded in the future into something more general like @tgross35 suggested in https://github.com/rust-lang/rust/issues/123831#issuecomment-2064728053. I think it would be also possible to disallow the `f32` fallback in a future edition.\r\n\r\nAs expected, a crater check showed [no non-spurious regressions](https://github.com/rust-lang/rust/pull/139087#issuecomment-2764732580).\r\n\r\nFor reference, I\u0027ve based the implementation loosely on the existing `calculate_diverging_fallback`. This first commit adds the `f32` fallback, the second adds `impl From\u003cf16\u003e for f32`, and the third adds a FCW lint for the `f32` fallback. I think this falls under the types team, so\r\nr? types\r\n\r\nFixes: rust-lang/rust#123831\r\nTracking issue: rust-lang/rust#116909\r\n\r\n@rustbot label +T-lang +T-types +T-libs-api +F-f16_and_f128\r\n\r\nTo decide on whether a future-incompatibility warning is desired or otherwise (see above):\r\n@rustbot label +I-lang-nominated\r\n\r\ncc https://github.com/rust-lang/rust/issues/154024 https://github.com/rust-lang/rust/issues/154005",
  "tree_diff": []
}
