-
Notifications
You must be signed in to change notification settings - Fork 13.9k
std: Rename Show/String to Debug/Display #21457
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
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
|
r? @brson (rust_highfive has picked a reviewer for you, use r? to override) |
|
r? @aturon |
c32db8f to
89c0be6
Compare
This commit is an implementation of [RFC 565][rfc] which is a stabilization of the `std::fmt` module and the implementations of various formatting traits. Specifically, the following changes were performed: [rfc]: https://github.com/rust-lang/rfcs/blob/master/text/0565-show-string-guidelines.md * The `Show` trait is now deprecated, it was renamed to `Debug` * The `String` trait is now deprecated, it was renamed to `Display` * Many `Debug` and `Display` implementations were audited in accordance with the RFC and audited implementations now have the `#[stable]` attribute * Integers and floats no longer print a suffix * Smart pointers no longer print details that they are a smart pointer * Paths with `Debug` are now quoted and escape characters * The `unwrap` methods on `Result` now require `Display` instead of `Debug` * The `Error` trait no longer has a `detail` method and now requires that `Display` must be implemented. With the loss of `String`, this has moved into libcore. * `impl<E: Error> FromError<E> for Box<Error>` now exists * `derive(Show)` has been renamed to `derive(Debug)`. This is not currently warned about due to warnings being emitted on stage1+ While backwards compatibility is attempted to be maintained with a blanket implementation of `Display` for the old `String` trait (and the same for `Show`/`Debug`) this is still a breaking change due to primitives no longer implementing `String` as well as modifications such as `unwrap` and the `Error` trait. Most code is fairly straightforward to update with a rename or tweaks of method calls. [breaking-change] Closes rust-lang#21436
89c0be6 to
3cb9fa2
Compare
|
Nicely done, @alexcrichton! |
This was referenced Jan 21, 2015
alexcrichton
added a commit
to alexcrichton/rust
that referenced
this pull request
Jan 21, 2015
Conflicts: src/liballoc/boxed.rs src/librustc/middle/traits/error_reporting.rs src/libstd/sync/mpsc/mod.rs
|
This seems to have broken make check-stage1: src/compiletest/common.rs:16:28: 16:33 error: unknown |
ianbollinger
added a commit
to ianbollinger/docopt.rs
that referenced
this pull request
Jan 23, 2015
This commit replaces usage of the Show and fmt::String traits with the Debug and Display traits. This was required to fix breaking changes introduced by rust-lang/rust#21457. Additionally, the superfluous `detail` method on `docopt::Error` was removed as it no longer exists in the trait. Also, hi!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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