api-guidelines icon indicating copy to clipboard operation
api-guidelines copied to clipboard

Extend C-DEREF guideline to say smart pointers should always be transparent in Debug representation

Open dtolnay opened this issue 6 years ago • 7 comments

The canonical Debug implementation for any type that implements Deref is:

Debug::fmt(&**self, formatter)

This principle came up during libs team discussion of https://github.com/rust-lang/rust/pull/48553.

dtolnay avatar May 17 '18 04:05 dtolnay

Seems reasonable to me!

KodrAus avatar Dec 22 '20 04:12 KodrAus

@rfcbot fcp merge

KodrAus avatar Dec 22 '20 05:12 KodrAus

@rfcbot fcp merge

This suggests a guideline that smart pointers inherit the Debug implementation of their pointee.

KodrAus avatar Dec 22 '20 11:12 KodrAus

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

  • [x] @Amanieu
  • [x] @BurntSushi
  • [x] @KodrAus
  • [x] @dtolnay
  • [ ] @m-ou-se
  • [x] @sfackler
  • [ ] @withoutboats

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 avatar Dec 22 '20 12:12 rfcbot

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

psst @KodrAus, I wasn't able to add the final-comment-period label, please do so.

rfcbot avatar Dec 31 '20 16:12 rfcbot

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.

The RFC will be merged soon.

psst @KodrAus, I wasn't able to add the finished-final-comment-period label, please do so.

rfcbot avatar Jan 10 '21 16:01 rfcbot

Given this passed FCP, should the change be made?

jonhoo avatar Dec 15 '23 12:12 jonhoo