Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TryFrom is not implemented for some primitive types #43214

Closed
MageSlayer opened this issue Jul 13, 2017 · 2 comments
Closed

TryFrom is not implemented for some primitive types #43214

MageSlayer opened this issue Jul 13, 2017 · 2 comments
Assignees
Labels
C-feature-request Category: A feature request, i.e: not implemented / a PR. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@MageSlayer
Copy link

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.

@GuillaumeGomez GuillaumeGomez self-assigned this Jul 13, 2017
@GuillaumeGomez GuillaumeGomez added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Jul 13, 2017
@Mark-Simulacrum Mark-Simulacrum added the C-feature-request Category: A feature request, i.e: not implemented / a PR. label Jul 28, 2017
@Rantanen
Copy link
Contributor

We have the blanket impls through From<T> for T now. That takes care of this, right?

Ping @GuillaumeGomez, given his involvement in the referred PR.

@sfackler
Copy link
Member

Yep, these are now covered.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-feature-request Category: A feature request, i.e: not implemented / a PR. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

5 participants