Uh oh!
There was an error while loading. Please reload this page.
fmt: impl fmt::Pointer for smart pointer types - #24144
Conversation
rust-highfive
commented
Apr 7, 2015
r? @pcwalton (rust_highfive has picked a reviewer for you, use r? to override) |
richo
commented
Apr 7, 2015
This builds and does something reasonable on my machine. Is it worth adding a test? Also, are there any other smart pointer types that I should impl for? The only other one that looks relevant is |
richo
commented
Apr 7, 2015
Bonus impls for the other smart pointers I could find |
There was a problem hiding this comment.
I think that this is infinitely recursive, did you mean &**self?
There was a problem hiding this comment.
Oops. Is Box specialcased in some way in the compiler? I can't seem to extract the Unique within using tuple access or a destructuring match.
expected `Box<T>`,
found `boxed::Box<_>`
(expected box,
found struct `boxed::Box`) [E0308]
/Users/richo/code/ext/rust/src/liballoc/boxed.rs:282 &Box(uniq) => fmt::Pointer::fmt(&uniq, f)
There was a problem hiding this comment.
Yeah Box is pretty special, and I'm not actually sure the definition has much bearing on what you can do with the type itself. You'll probably want to pull out &T from &Box<T> and then format that.
alexcrichton
commented
Apr 7, 2015
Could you add a smoke test for the |
richo
commented
Apr 7, 2015
Sure, I'll work out how I goofed box and add the test. |
richo
commented
Apr 8, 2015
I added a test, and made it pad pointers to native pointer width if no format is specified, which I bellieve to be correct. Let me know if I should rip that off though. Make check is running on my machine, but I tested that the test case added works with a stage1. |
richo
commented
Apr 8, 2015
(make check passes locally, on osx) |
There was a problem hiding this comment.
Could this change be left to another PR?
richo
commented
Apr 8, 2015
Rebased, this is now only the fmt::Pointer implementation |
alexcrichton
commented
Apr 8, 2015
Thanks! Could you also squash the commits together? Other than that r=me |
richo
commented
Apr 8, 2015
Done, thanks! |
alexcrichton
commented
Apr 8, 2015
bors
commented
Apr 8, 2015
~~I believe this should fix the issue. Opening a PR to ensure noone duplicates effort, I'm running check now.~~ Closes#24091
bors
commented
Apr 9, 2015
This pads out the printing of pointers to their native width. Extracted from and rebased on top of #24144
This pads out the printing of pointers to their native width. Extracted from and rebased on top of #24144
I believe this should fix the issue. Opening a PR to ensure noone duplicates effort, I'm running check now.Closes#24091