-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Stabilize debug builders #24847
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
Stabilize debug builders #24847
Conversation
r? @brson (rust_highfive has picked a reviewer for you, use r? to override) |
☔ The latest upstream changes (presumably #24967) made this pull request unmergeable. Please resolve the merge conflicts. |
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. |
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. |
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: |
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 |
@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))
.... |
Excellent, that already works! |
f18282b
to
e161d5c
Compare
Rebased and shifted to stabilize for 1.2.0 instead of 1.1.0. |
📌 Commit e161d5c has been approved by |
⌛ Testing commit e161d5c with merge 258907d... |
⛄ The build was interrupted to prioritize another pull request. |
⌛ Testing commit e161d5c with merge 806e61f... |
💔 Test failed - auto-mac-32-opt |
@bors retry |
…r=aturon The `debug_builders` feature is up for 1.1 stabilization in rust-lang#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: * Should `debug_tuple_struct` and `DebugTupleStruct` be used instead of `debug_tuple` and `DebugTuple`? It's more typing but is a technically more correct name. * `DebugStruct` and `DebugTuple` have `field` methods while `DebugSet`, `DebugMap` and `DebugList` have `entry` methods. Should we switch those to something else for consistency? cc @alexcrichton @aturon
The `debug_builders` feature 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: * Should `debug_tuple_struct` and `DebugTupleStruct` be used instead of `debug_tuple` and `DebugTuple`? It's more typing but is a technically more correct name. * `DebugStruct` and `DebugTuple` have `field` methods while `DebugSet`, `DebugMap` and `DebugList` have `entry` methods. Should we switch those to something else for consistency? cc @alexcrichton @aturon
🌴 |
The
debug_builders
feature 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_struct
andDebugTupleStruct
be used instead ofdebug_tuple
andDebugTuple
? It's more typing but is a technically more correct name.DebugStruct
andDebugTuple
havefield
methods whileDebugSet
,DebugMap
andDebugList
haveentry
methods. Should we switch those to something else for consistency?cc @alexcrichton @aturon