rust-highfive · GitHub

This was referenced

Jul 12, 2016

Closed

Closed

@durka

@durka

@durka

@durka

@durka durka changed the title add stable wrapper for discriminant_value intrinsic add soon-to-be-stable wrapper for discriminant_value intrinsic

Jul 12, 2016

@brson brson added the relnotes

Marks issues that should be documented in the release notes of the next release.

label

Jul 12, 2016

@durka

@durka durka mentioned this pull request

Aug 1, 2016

Merged

@durka durka changed the title [WIP] add wrapper for discriminant_value intrinsic [RFC accepted] add wrapper for discriminant_value intrinsic

Sep 16, 2016

@durka

Closed

nagisa

nagisa

@durka

@durka Alex Burka

@durka

@durka durka mentioned this pull request

Sep 29, 2016

Merged

bors added a commit that referenced this pull request

Sep 30, 2016
add wrapper for discriminant_value, take 2
[This is #34785 reopened, since @bors apparently gave up on that thread.]
add wrapper for discriminant_value intrinsic
Implementation of [RFC 1696](https://github.com/rust-lang/rfcs/blob/master/text/1696-discriminant.md).
Wraps the `discriminant_value` intrinsic under the name `std::mem::discriminant`. In order to avoid prematurely leaking information about the implementation of enums, the return value is an opaque type, generic over the enum type, which implements Copy, Clone, PartialEq, Eq, Hash, and Debug (notably not PartialOrd). There is currently no way to get the value out excepting printing the debug representation.
The wrapper is safe and can be stabilized soon as per discussion in #24263.
cc @aturon
r? @nagisa

Read the original on github.com ↗