Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upStabilize debug builders #24847
Conversation
rust-highfive
assigned
brson
Apr 26, 2015
This comment has been minimized.
This comment has been minimized.
|
r? @brson (rust_highfive has picked a reviewer for you, use r? to override) |
This comment has been minimized.
This comment has been minimized.
rust-highfive
assigned
alexcrichton
and unassigned
brson
Apr 26, 2015
This comment has been minimized.
This comment has been minimized.
|
|
This comment has been minimized.
This comment has been minimized.
|
We got a chance to talk about this today, and the general feeling here is that this stabilization feels a little rushed. I'm curious, but do you know if there's much usage of this feature today? I was personally unaware of many users of this feature or your Overall these APIs also seem like they haven't been subjected to the scrutiny one might expect from a stable API (from the community at large, not necessarily just us per se). In terms of stabilizing new APIs in the standard library we've toyed with the idea of a "final comment period"-like segment of time where users of Rust can browse soon-to-be-stable APIs, but this would take some infrastructure investment to see it realized. To be clear I don't think the 1.1 window has passed for this feature once we release 1.0, I'm fine cherry picking a change such as this back into beta. |
This comment has been minimized.
This comment has been minimized.
|
I'm not aware of a ton of consumers of the API - explicit Debug impls appear to be pretty rare: https://github.com/search?l=rust&p=3&q=%22Debug+for%22&ref=searchresults&type=Code&utf8=%E2%9C%93 Every derived I think a "final comment period" style thing is a good idea, especially for APIs like this that aren't incredibly heavily used. |
This comment has been minimized.
This comment has been minimized.
|
I used this API recently, and I wanted a way to display one of my fields in hex. Can we find a simple composable way to do that? I sort of wanted something like this to work: |
This comment has been minimized.
This comment has been minimized.
|
The most straightforward way to deal with that right now would be something like struct DebugHex<T>(T);
impl<T: LowerHex> Debug for DebugHex<T> {
fn fmt(&self, fmt: &mut Formatter) -> Result {
self.0.fmt(fmt)
}
}
...
.field("flag", &DebugHex(&tag))
...I'm not sure if there's a way to abstract over |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
@bluss Actually realized that my original suggestion is both more verbose than it needs to be and not quite right. We don't want to directly forward the ....
.field("flag", &format_args!("{:x}", self.tag))
.... |
This comment has been minimized.
This comment has been minimized.
|
Excellent, that already works! |
sfackler
force-pushed the
sfackler:debug-builders-stability
branch
from
f18282b
to
e161d5c
May 20, 2015
This comment has been minimized.
This comment has been minimized.
|
Rebased and shifted to stabilize for 1.2.0 instead of 1.1.0. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
|
This comment has been minimized.
This comment has been minimized.
bors
added a commit
that referenced
this pull request
May 21, 2015
This comment has been minimized.
This comment has been minimized.
|
|
bors
added a commit
that referenced
this pull request
May 21, 2015
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
|
This comment has been minimized.
This comment has been minimized.
|
@bors retry |
Manishearth
added a commit
to Manishearth/rust
that referenced
this pull request
May 22, 2015
bors
added a commit
that referenced
this pull request
May 23, 2015
This comment has been minimized.
This comment has been minimized.
bors
added a commit
that referenced
this pull request
May 23, 2015
This comment has been minimized.
This comment has been minimized.
bors
merged commit e161d5c
into
rust-lang:master
May 23, 2015
This comment has been minimized.
This comment has been minimized.
|
|
sfackler commentedApr 26, 2015
The
debug_buildersfeature is up for 1.1 stabilization in #24028. This commit stabilizes the API as-is with no changes.Some nits that @alexcrichton mentioned that may be worth discussing now if anyone cares:
debug_tuple_structandDebugTupleStructbe used instead ofdebug_tupleandDebugTuple? It's more typing but is a technically more correct name.DebugStructandDebugTuplehavefieldmethods whileDebugSet,DebugMapandDebugListhaveentrymethods. Should we switch those to something else for consistency?cc @alexcrichton @aturon