Skip to content

f32::from(<untyped float>) inference with f16 and f128 #123831

@tgross35

Description

@tgross35

Adding a From<f16> for f32 impl breaks some inference that currently works. From #123824:

fn main() {
    let x = f32::from(3.14);
}

The new float types are a long way from being stable, but it may be good to decide how to handle things if we would like this implementation one day. Per @fmease at #123824 (comment), there are three options:

  1. Accept this regression since technically, no stable API is broken
  2. Say that we do not want From<f16> for f32
  3. Make this implementation available starting with the new edition

I'll mark this with the edition label so it can at least come into consideration, but this is the lowest priority thing on any list.

Known failure points from adding this directly:

@rustbot label +T-lang +T-libs +A-edition-2024 +F-f16_and_f128

Metadata

Metadata

Assignees

No one assigned

    Labels

    F-f16_and_f128`#![feature(f16)]`, `#![feature(f128)]`T-langRelevant to the language team, which will review and decide on the PR/issue.T-libsRelevant to the library team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions