Skip to content

Display traits not implemented for Wrapping<T> #33659

Closed
@ketsuban

Description

@ketsuban

Wrapping<T> is a bit sorry-looking right now. let foo: Wrapping<u8> = 3; and Wrapping(1) + 1 are type errors, rather than assigning foo the value Wrapping(3) and having the value Wrapping(2) as I expected. You can't even print them.

use std::num::Wrapping;

fn main() {
    let x: Wrapping<u8> = Wrapping(47);
    println!("{}", x);
}

I asked in #rust and the consensus was the arithmetic is a little more controversial because of the potential for a combinatoric explosion of impls, but that std::fmt's fun toys are low-effort high-awesome and so warrant filing an issue.

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