std: Rename Show/String to Debug/Display #21457
Merged
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
This commit is an implementation of RFC 565 which is a stabilization of
the
std::fmtmodule and the implementations of various formatting traits.Specifically, the following changes were performed:
Showtrait is now deprecated, it was renamed toDebugStringtrait is now deprecated, it was renamed toDisplayDebugandDisplayimplementations were audited in accordance with theRFC and audited implementations now have the
#[stable]attributeDebugare now quoted and escape charactersunwrapmethods onResultnow requireDisplayinstead ofDebugErrortrait no longer has adetailmethod and now requires thatDisplaymust be implemented. With the loss ofString, this has moved intolibcore.
impl<E: Error> FromError<E> for Box<Error>now existsderive(Show)has been renamed toderive(Debug). This is not currentlywarned about due to warnings being emitted on stage1+
While backwards compatibility is attempted to be maintained with a blanket
implementation of
Displayfor the oldStringtrait (and the same forShow/Debug) this is still a breaking change due to primitives no longerimplementing
Stringas well as modifications such asunwrapand theErrortrait. Most code is fairly straightforward to update with a rename or tweaks of
method calls.
[breaking-change]
Closes #21436