-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
atomic: remove 'Atomic*' from Debug output #48553
Conversation
r? @aidanhs (rust_highfive has picked a reviewer for you, use r? to override) |
There are some stability concerns here (see the thread in #47619) for a similar change that caused somewhat widespread breakage. However, I feel that it is warranted to make this change -- with a note for the compatibility notes. |
I'm not sold on printing just One reason for that, I imagine, is that the interior mutability has repercussions for when the value can change, which is something you'd really want to keep in mind while debugging by looking at snapshots of the program state. Thus the reminder that this is not an ordinary integer but one with interior mutability is useful and not just noise. This is even more drastic for atomic primitives than for Cell, since printing an atomic value that another thread is modifying is the very model of a race condition -- assuming these are normal shared-xor-mutable integers could easily be very misleading. |
@rkruppe I was actually looking at I do think that the extra info is probably needed for |
I personally am prefer it as-is (for the same reasons as But up to libs team - at random, r? @withoutboats |
I'll share what I'm looking at that prompted me writing this patch:
To me, that is noisy and doesn't provide any benefit, compared to:
Notably, those counters are actually I don't feel that since some internal, private state of the item needs atomic operations to change is important at all when printing a |
Ping from the release team @withoutboats! This PR needs your review! |
Ping from triage! This PR needs a review. Can @withoutboats or someone else from @rust-lang/libs do it? |
I'd personally lean towards removing wrapper types where possible in the sense that we don't want to debug I'd like some input from others at @rust-lang/libs, though, so I've tagged this now as waiting on the team. I also agree though that we'd want to be consistent, so it'd be great to touch up other known cases (like |
Ping from triage @rust-lang/libs! Your opinion is needed :) |
+1. I’m in favor of making wrapper types like this and |
This was discussed during @rust-lang/libs triage and the conclusion was that this is good to go. Follow-ups can always update the other types in libstd. @bors: r+ |
📌 Commit c689db2 has been approved by |
atomic: remove 'Atomic*' from Debug output For the same reason that we don't show `Vec { data: [0, 1, 2, 3] }`, but just the array, the `AtomicUsize(1000)` is noisy, and seeing just `1000` is likely better.
☀️ Test successful - status-appveyor, status-travis |
For the same reason that we don't show
Vec { data: [0, 1, 2, 3] }
, but just the array, theAtomicUsize(1000)
is noisy, and seeing just1000
is likely better.