Skip to content
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

Tracking Issue for debug_more_non_exhaustive #127942

Closed
2 of 4 tasks
tgross35 opened this issue Jul 18, 2024 · 11 comments · Fixed by #131109
Closed
2 of 4 tasks

Tracking Issue for debug_more_non_exhaustive #127942

tgross35 opened this issue Jul 18, 2024 · 11 comments · Fixed by #131109
Labels
C-tracking-issue Category: A tracking issue for an RFC or an unstable feature. finished-final-comment-period The final comment period is finished for this PR / Issue. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.

Comments

@tgross35
Copy link
Contributor

tgross35 commented Jul 18, 2024

Feature gate: #![feature(debug_more_non_exhaustive)]

This is a tracking issue for the non_exhaustive() function on fmt::Debug{List, Map, Set, Tuple}, which provides an easy way to omit fields with ...

Public API

// core::fmt

impl<'a, 'b: 'a> DebugList<'a, 'b> {
    pub fn finish_non_exhaustive(&mut self) -> Result<(), Error>;
}

impl<'a, 'b: 'a> DebugMap<'a, 'b> {
    pub fn finish_non_exhaustive(&mut self) -> Result<(), Error>;
}

impl<'a, 'b: 'a> DebugSet<'a, 'b> {
    pub fn finish_non_exhaustive(&mut self) -> Result<(), Error>;
}

impl<'a, 'b: 'a> DebugTuple<'a, 'b> {
    pub fn finish_non_exhaustive(&mut self) -> Result<(), Error>;
}

Steps / History

Unresolved Questions

  • None yet.

Footnotes

  1. https://std-dev-guide.rust-lang.org/feature-lifecycle/stabilization.html

@tgross35 tgross35 added T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. C-tracking-issue Category: A tracking issue for an RFC or an unstable feature. labels Jul 18, 2024
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Aug 21, 2024
…, r=Noratrieb

Implement `debug_more_non_exhaustive`

This implements the ACP at rust-lang/libs-team#248, adding `.finish_non_exhaustive()` for `DebugTuple`, `DebugSet`, `DebugList`, and `DebugMap`.

Also used this as an opportunity to make some documentation and tests more readable by using raw strings instead of escaped quotes.

Tracking issue: rust-lang#127942
jieyouxu added a commit to jieyouxu/rust that referenced this issue Aug 22, 2024
…, r=Noratrieb

Implement `debug_more_non_exhaustive`

This implements the ACP at rust-lang/libs-team#248, adding `.finish_non_exhaustive()` for `DebugTuple`, `DebugSet`, `DebugList`, and `DebugMap`.

Also used this as an opportunity to make some documentation and tests more readable by using raw strings instead of escaped quotes.

Tracking issue: rust-lang#127942
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Aug 22, 2024
Rollup merge of rust-lang#127945 - tgross35:debug-more-non-exhaustive, r=Noratrieb

Implement `debug_more_non_exhaustive`

This implements the ACP at rust-lang/libs-team#248, adding `.finish_non_exhaustive()` for `DebugTuple`, `DebugSet`, `DebugList`, and `DebugMap`.

Also used this as an opportunity to make some documentation and tests more readable by using raw strings instead of escaped quotes.

Tracking issue: rust-lang#127942
@clarfonthey
Copy link
Contributor

Small bit of feedback as I'm looking through this, but it feels like it might be useful to actually have the non_exhaustive marker anywhere inside these, rather than just at the end.

Example where it'd be useful: I'm working on a tool to help more easily verify that double-ended iterators are working, and they accumulate their data into a VecDeque that gets rotated back to the correct position once everything has been accumulated. Therefore, when displaying this data in a Debug impl, it would make more sense to indicate the "non-exhaustive" marker in the middle of the list, rather than at the end, since the missing elements will end up between the ones that have already been added to the beginning and end.

While structs have no order to their fields (and thus, adding to the end is appropriate every time), lists do have relevant order here, and it feels reasonable to put the marker in the middle.

For now, I'll just add a RangeFull entry anyway since that covers it, but it feels like it would be reasonable to do it as a field rather than just a finish_non_exhaustive like structs do it.

@tgross35
Copy link
Contributor Author

That is an interesting idea. Are you imagining that this would be something like .field_elided().finish() rather than .finish_non_exhaustive()?

@clarfonthey
Copy link
Contributor

That's pretty much what I was thinking. I hadn't thought of a good name for it, but, yes.

@tgross35
Copy link
Contributor Author

tgross35 commented Sep 25, 2024

I think that is a good idea, guess libs-api feedback is needed.

@rustbot label +I-libs-api-nominated

Requesting discussion about whether we should replace the current unstable API with @clarfonthey's suggestion above. This would mean something like .elided_fields()/.elided_entries() methods that print .. at any position. Whether we want the same thing for DebugStruct, which already has finish_non_exhaustive, should also be considered (see #127942 (comment)).

(Name suggestions welcome, skipped_fields?)

@rustbot rustbot added the I-libs-api-nominated Nominated for discussion during a libs-api team meeting. label Sep 25, 2024
@clarfonthey
Copy link
Contributor

Note that like I mentioned, I don't think that DebugStruct needs this since the fields in a struct can be reordered but the .. must always be at the end, whereas lists and maps do have an explicit order to their fields.

@joshtriplett
Copy link
Member

We discussed this in today's @rust-lang/libs-api meeting. We'd like to stabilize these four finish_non_exhaustive methods as-is.

We may also be amenable to adding elided_xyz() methods to show elisions in the middle of an array/tuple/struct/etc, but that'd be separate.

@joshtriplett
Copy link
Member

FCP to stabilize:

@rfcbot merge

@rfcbot
Copy link

rfcbot commented Oct 1, 2024

Team member @joshtriplett has proposed to merge this. The next step is review by the rest of the tagged team members:

No concerns currently listed.

Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up!

See this document for info about what commands tagged team members can give me.

@rfcbot rfcbot added proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off. disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. labels Oct 1, 2024
@joshtriplett joshtriplett removed T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off. C-tracking-issue Category: A tracking issue for an RFC or an unstable feature. disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. I-libs-api-nominated Nominated for discussion during a libs-api team meeting. labels Oct 1, 2024
@rfcbot rfcbot added the final-comment-period In the final comment period and will be merged soon unless new substantive objections are raised. label Oct 1, 2024
@rfcbot
Copy link

rfcbot commented Oct 1, 2024

🔔 This is now entering its final comment period, as per the review above. 🔔

@tgross35
Copy link
Contributor Author

tgross35 commented Oct 1, 2024

Oh, well that's easier :) candidate PR for after FCP #131109

@tgross35 tgross35 added T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. C-tracking-issue Category: A tracking issue for an RFC or an unstable feature. labels Oct 1, 2024
@rfcbot rfcbot added the finished-final-comment-period The final comment period is finished for this PR / Issue. label Oct 11, 2024
@rfcbot rfcbot added to-announce Announce this issue on triage meeting and removed final-comment-period In the final comment period and will be merged soon unless new substantive objections are raised. labels Oct 11, 2024
@rfcbot
Copy link

rfcbot commented Oct 11, 2024

The final comment period, with a disposition to merge, as per the review above, is now complete.

As the automated representative of the governance process, I would like to thank the author for their work and everyone else who contributed.

This will be merged soon.

tgross35 added a commit to tgross35/rust that referenced this issue Oct 11, 2024
…exhaustive, r=joboet

Stabilize `debug_more_non_exhaustive`

Fixes: rust-lang#127942
tgross35 added a commit to tgross35/rust that referenced this issue Oct 11, 2024
…exhaustive, r=joboet

Stabilize `debug_more_non_exhaustive`

Fixes: rust-lang#127942
@bors bors closed this as completed in 2bc2304 Oct 12, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Oct 12, 2024
Rollup merge of rust-lang#131109 - tgross35:stabilize-debug_more_non_exhaustive, r=joboet

Stabilize `debug_more_non_exhaustive`

Fixes: rust-lang#127942
@apiraino apiraino removed the to-announce Announce this issue on triage meeting label Oct 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-tracking-issue Category: A tracking issue for an RFC or an unstable feature. finished-final-comment-period The final comment period is finished for this PR / Issue. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants