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

Display traits not implemented for Wrapping<T> #33659

Closed
ketsuban opened this issue May 15, 2016 · 2 comments
Closed

Display traits not implemented for Wrapping<T> #33659

ketsuban opened this issue May 15, 2016 · 2 comments

Comments

@ketsuban
Copy link
Contributor

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.

@ollie27
Copy link
Member

ollie27 commented May 15, 2016

Looks like it's already implemented #33023.

@hanna-kruppe
Copy link
Contributor

Oh, good. But according to nightly docs, the other formatting traits (UpperHex, LowerHex, Binary, Octal + any I forgot) aren't implemented yet.

Manishearth added a commit to Manishearth/rust that referenced this issue Jun 22, 2016
Implement Binary, Octal, LowerHex and UpperHex for Wrapping<T>

Fixes: rust-lang#33659
Manishearth added a commit to Manishearth/rust that referenced this issue Jun 22, 2016
Implement Binary, Octal, LowerHex and UpperHex for Wrapping<T>

Fixes: rust-lang#33659
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants