diff options
| author | bors <bors@rust-lang.org> | 2013-10-05 14:26:44 -0700 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2013-10-05 14:26:44 -0700 |
| commit | 2733b189ac60cea541fbf80e5839e5027ffc9fbf (patch) | |
| tree | b9fcc58a2f736f292eb32de9553843c99f91f32d /src/test/codegen/stack-alloc-string-slice.rs | |
| parent | 0c388be8d1988a966ef62c545b996b9da0f71e93 (diff) | |
| parent | 0e8ad4d8a2f23206c723137d765027a7acd97837 (diff) | |
| download | rust-2733b189ac60cea541fbf80e5839e5027ffc9fbf.tar.gz rust-2733b189ac60cea541fbf80e5839e5027ffc9fbf.zip | |
auto merge of #9250 : erickt/rust/num, r=erickt
This PR solves one of the pain points with c-style enums. Simplifies writing a fn to convert from an int/uint to an enum. It does this through a `#[deriving(FromPrimitive)]` syntax extension. Before this is committed though, we need to discuss if `ToPrimitive`/`FromPrimitive` has the right design (cc #4819). I've changed all the `.to_int()` and `from_int()` style functions to return `Option<int>` so we can handle partial functions. For this PR though only enums and `extra::num::bigint::*` take advantage of returning None for unrepresentable values. In the long run it'd be better if `i64.to_i8()` returned `None` if the value was too large, but I'll save this for a future PR. Closes #3868.
Diffstat (limited to 'src/test/codegen/stack-alloc-string-slice.rs')
0 files changed, 0 insertions, 0 deletions
