-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
C-feature-requestCategory: A feature request, i.e: not implemented / a PR.Category: A feature request, i.e: not implemented / a PR.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
Hi
It seems strange that not all primitive types support TryFrom trait.
See below
#![feature(try_from)]
use std::convert::TryFrom;
fn main() {
let u: usize = TryFrom::try_from(10usize).unwrap();
let u: u16 = TryFrom::try_from(10u16).unwrap();
let b: bool = TryFrom::try_from(false).unwrap();
let f: f32 = TryFrom::try_from(1.0f32).unwrap();
let f: f64 = TryFrom::try_from(1.0).unwrap();
}
Or https://play.rust-lang.org/?gist=fdfc5e5d4bd8a7ea1a9005ab4c850373&version=nightly
Current nightly implements TryFrom only for integers(?)
bool, f32, f64 fail.
Please fix that.
Metadata
Metadata
Assignees
Labels
C-feature-requestCategory: A feature request, i.e: not implemented / a PR.Category: A feature request, i.e: not implemented / a PR.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.