Skip to content

NonZero constructor now returns Option #1002

Closed
@dtolnay

Description

@dtolnay

rust-lang/rust#42959

error[E0308]: mismatched types
    --> src/de/impls.rs:1583:16
     |
1583 |             Ok(NonZero::new(value))
     |                ^^^^^^^^^^^^^^^^^^^ expected struct `core::nonzero::NonZero`, found enum `core::option::Option`
     |
     = note: expected type `core::nonzero::NonZero<T>`
                found type `core::option::Option<core::nonzero::NonZero<_>>`
     = help: here are some functions which might fulfill your needs:
             - .unwrap()

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions