-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Missing Debug Implementations #31869
Comments
What sense it makes to implement |
If it truly doesn't make sense to implement for an iterator, it can be marked |
Any value that can end up being part of a user's data structure should have Debug. The slice iterator is the simplest example, but I don't think we can find a good excuse for any iterator. |
I'll work on this a bit then. |
libcore: add Debug implementations to most missing types Also adds `#![deny(missing_debug_implementations)]` to the core crate. cc #31869
@seanmonstar Did you automatically generate the list above? If so, could you regenerate it to see what the current state of things is? |
@frewsxcv it was generated by setting |
From what I've seen, it is not uncommon for structures to have fields that are iterator structures. For me an end user, it's annoying that I can't just print the debug representation or derive |
For me, I don't really care if most |
Opened a PR for libstd: #38006 |
Part of rust-lang#31869. Also turn on the `missing_debug_implementations` lint at the crate level.
Implement `fmt::Debug` for all structures in libstd. Part of rust-lang#31869. Also turn on the `missing_debug_implementations` lint at the crate level.
Is this done, then, with @frewsxcv's PR merged? |
I don't think this is done. My PR only addressed |
Oh damn, forgot this issue. We should try to sync efforts on this. I'll work on libcollections. |
Related: rust-random/rand#130 |
Add missing Debug implementation for librand structs Part of #31869.
This should be done after #39002 merges I think. |
Thanks for your pull requests @GuillaumeGomez :) |
Add Debug implementations for libcollection structs Part of #31869.
Since #39002 has merged, this should be done. thanks everyone! |
Part of rust-lang/rust#31869. Also turn on the `missing_debug_implementations` lint at the crate level.
Add missing Debug impls to std_unicode Also adds `#![deny(missing_debug_implementations)]` so they don't get missed again. cc rust-lang#31869
The
missing_debug_implementations
will detect any public type that does not implementDebug
. Usually all public types should implementDebug
, even if it doesn't share all the internals in its formatting. This allows users toderive(Debug)
on their types when they contain a type fromstd
.I ran the lint against crates that have types exported in
std
, and I've grouped the results below. I think the eventual goal should be to add#![deny(missing_debug_implementations)]
to each crate. Any exceptions should be tagged#[allow(missing_debug_implementations)]
, though hopefully those should be very few.collections
src/libcollections/binary_heap.rs:672 pub struct Iter<'a, T: 'a>
src/libcollections/binary_heap.rs:712 pub struct IntoIter<T>
src/libcollections/binary_heap.rs:744 pub struct Drain<'a, T: 'a>
src/libcollections/btree/map.rs:188 pub struct Iter<'a, K: 'a, V: 'a>
src/libcollections/btree/map.rs:195 pub struct IterMut<'a, K: 'a, V: 'a>
src/libcollections/btree/map.rs:202 pub struct IntoIter<K, V>
src/libcollections/btree/map.rs:210 pub struct Keys<'a, K: 'a, V: 'a>
src/libcollections/btree/map.rs:216 pub struct Values<'a, K: 'a, V: 'a>
src/libcollections/btree/map.rs:221 pub struct Range<'a, K: 'a, V: 'a>
src/libcollections/btree/map.rs:227 pub struct RangeMut<'a, K: 'a, V: 'a>
src/libcollections/btree/map.rs:237 pub enum Entry<'a, K: 'a, V: 'a>
src/libcollections/btree/map.rs:253 pub struct VacantEntry<'a, K: 'a, V: 'a>
src/libcollections/btree/map.rs:264 pub struct OccupiedEntry<'a, K: 'a, V: 'a>
src/libcollections/btree/set.rs:49 pub struct Iter<'a, T: 'a>
src/libcollections/btree/set.rs:55 pub struct IntoIter<T>
src/libcollections/btree/set.rs:60 pub struct Range<'a, T: 'a>
src/libcollections/btree/set.rs:66 pub struct Difference<'a, T: 'a>
src/libcollections/btree/set.rs:73 pub struct SymmetricDifference<'a, T: 'a>
src/libcollections/btree/set.rs:80 pub struct Intersection<'a, T: 'a>
src/libcollections/btree/set.rs:87 pub struct Union<'a, T: 'a>
src/libcollections/enum_set.rs:218 pub struct Iter<E>
src/libcollections/linked_list.rs:59 pub struct Iter<'a, T: 'a>
src/libcollections/linked_list.rs:79 pub struct IterMut<'a, T: 'a>
src/libcollections/linked_list.rs:89 pub struct IntoIter<T>
src/libcollections/linked_list.rs:1052 pub struct FrontPlace<'a, T: 'a>
src/libcollections/linked_list.rs:1096 pub struct BackPlace<'a, T: 'a>
src/libcollections/str.rs:120 pub struct Utf16Units<'a>
src/libcollections/string.rs:1852 pub struct Drain<'a>
src/libcollections/vec.rs:1551 pub struct IntoIter<T>
src/libcollections/vec.rs:1649 pub struct Drain<'a, T: 'a>
src/libcollections/vec_deque.rs:1739 pub struct Iter<'a, T: 'a>
src/libcollections/vec_deque.rs:1795 pub struct IterMut<'a, T: 'a>
src/libcollections/vec_deque.rs:1848 pub struct IntoIter<T>
src/libcollections/vec_deque.rs:1881 pub struct Drain<'a, T: 'a>
rand
src/librand/distributions/range.rs:32 pub struct Range<X>
src/librand/distributions/gamma.rs:42 pub struct Gamma
src/librand/distributions/gamma.rs:180 pub struct ChiSquared
src/librand/distributions/gamma.rs:228 pub struct FisherF
src/librand/distributions/gamma.rs:263 pub struct StudentT
src/librand/distributions/normal.rs:32 pub struct StandardNormal(pub f64);
src/librand/distributions/normal.rs:80 pub struct Normal
src/librand/distributions/normal.rs:118 pub struct LogNormal
src/librand/distributions/exponential.rs:33 pub struct Exp1(pub f64);
src/librand/distributions/exponential.rs:62 pub struct Exp
src/librand/distributions/mod.rs:57 pub struct RandSample<Sup>
src/librand/distributions/mod.rs:80 pub struct Weighted<T>
src/librand/distributions/mod.rs:96 pub struct WeightedChoice<'a, T: 'a>
src/librand/isaac.rs:38 pub struct IsaacRng
src/librand/isaac.rs:316 pub struct Isaac64Rng
src/librand/chacha.rs:29 pub struct ChaChaRng
src/librand/reseeding.rs:22 pub struct ReseedingRng<R, Rsdr>
src/librand/reseeding.rs:107 pub struct ReseedWithDefault;
src/librand/lib.rs:282 pub struct Generator<'a, T, R: 'a>
src/librand/lib.rs:298 pub struct AsciiGenerator<'a, R: 'a>
src/librand/lib.rs:334 pub struct XorShiftRng
src/librand/lib.rs:420 pub struct Open01<F>(pub F);
src/librand/lib.rs:428 pub struct Closed01<F>(pub F);
The text was updated successfully, but these errors were encountered: