Skip to content

#[derive(FromPrimitive)] should use the num crate #24822

Closed
@lilyball

Description

@lilyball

The compiler still supports #[derive(FromPrimitive)] but it uses std::num::FromPrimitive which doesn't exist anymore. The compiler should remove its built-in support for #[derive_FromPrimitive] and the num crate should implement it instead.

Alternatively, to avoid the need for #![feature(custom_derive)], the compiler's built-in support could be adjusted to use num::traits::FromPrimitive instead, with the expectation that clients will adopt the external num crate, but this approach is inflexible (the num crate can't change FromPrimitive without breaking compatibility).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions