lang-team icon indicating copy to clipboard operation
lang-team copied to clipboard

We need to settle the behaviour of floating-point in `const`

Open scottmcm opened this issue 2 years ago • 3 comments

Summary

We need to settle what matching means -- is it bitwise structural on the non-padding? is it PartialEq? -- and in particular what are the implications of that for floats (with NAN and ±0 and ...)

Per niko this has been an issue since Rust 0.8; it would be really nice to resolve it 🙂

Background reading

https://github.com/rust-lang/rust/pull/116098 https://github.com/rust-lang/rust/pull/116284

(scottmcm is opening this as requested in the 2023-10-03 lang meeting, but doesn't really have the context to write a doc for the meeting)

Include any links to material that folks ought to try to read before-hand.

About this issue

This issue corresponds to a lang-team design meeting proposal. It corresponds to a possible topic of discussion that may be scheduled for deeper discussion during one of our design meetings.

scottmcm avatar Oct 03 '23 18:10 scottmcm

I think this should be part of https://github.com/rust-lang/lang-team/issues/220.

RalfJung avatar Oct 03 '23 19:10 RalfJung

@scottmcm the title talks about FP in const in general, but I think you actually mean FP in patterns?

We didn't get to this when meeting for #220 so this might still warrant a separate meeting.

RalfJung avatar Oct 20 '23 16:10 RalfJung

cc https://github.com/rust-lang/rfcs/pull/3514

pnkfelix avatar Jun 12 '24 16:06 pnkfelix

I think we've now addressed this with RFCs. If there are any remaining open items on this, please feel free to reopen (or file a nominated issue asking us to do so).

joshtriplett avatar Sep 04 '24 16:09 joshtriplett