Skip to content

Commit 34afe5e

Browse files
committed
Rename Show to Debug, String to Display
Update reference.md: - derive() no longer supports Zero trait - derive() now supports Copy trait
1 parent 725cc06 commit 34afe5e

File tree

9 files changed

+13
-14
lines changed

9 files changed

+13
-14
lines changed

src/doc/reference.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -2354,8 +2354,8 @@ Supported traits for `derive` are:
23542354
* `FromPrimitive`, to create an instance from a numeric primitive.
23552355
* `Hash`, to iterate over the bytes in a data type.
23562356
* `Rand`, to create a random instance of a data type.
2357-
* `Show`, to format a value using the `{}` formatter.
2358-
* `Zero`, to create a zero instance of a numeric data type.
2357+
* `Debug`, to format a value using the `{:?}` formatter.
2358+
* `Copy`, for "Plain Old Data" types which can be copied by simply moving bits.
23592359

23602360
### Compiler Features
23612361

src/libcore/any.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
//! # Examples
2828
//!
2929
//! Consider a situation where we want to log out a value passed to a function.
30-
//! We know the value we're working on implements Show, but we don't know its
30+
//! We know the value we're working on implements Debug, but we don't know its
3131
//! concrete type. We want to give special treatment to certain types: in this
3232
//! case printing out the length of String values prior to their value.
3333
//! We don't know the concrete type of our value at compile time, so we need to

src/libgetopts/lib.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ pub struct Matches {
195195
}
196196

197197
/// The type returned when the command line does not conform to the
198-
/// expected format. Use the `Show` implementation to output detailed
198+
/// expected format. Use the `Debug` implementation to output detailed
199199
/// information.
200200
#[derive(Clone, PartialEq, Eq, Debug)]
201201
pub enum Fail {
@@ -545,7 +545,7 @@ impl Fail {
545545
/// Convert a `Fail` enum into an error string.
546546
#[unstable(feature = "rustc_private")]
547547
#[deprecated(since = "1.0.0",
548-
reason = "use `fmt::String` (`{}` format specifier)")]
548+
reason = "use `fmt::Display` (`{}` format specifier)")]
549549
pub fn to_err_msg(self) -> String {
550550
self.to_string()
551551
}
@@ -579,7 +579,7 @@ impl fmt::Display for Fail {
579579
/// `opt_str`, etc. to interrogate results.
580580
/// # Panics
581581
///
582-
/// Returns `Err(Fail)` on failure: use the `Show` implementation of `Fail` to display
582+
/// Returns `Err(Fail)` on failure: use the `Debug` implementation of `Fail` to display
583583
/// information about it.
584584
pub fn getopts(args: &[String], optgrps: &[OptGroup]) -> Result {
585585
let opts: Vec<Opt> = optgrps.iter().map(|x| x.long_to_short()).collect();

src/librustc/middle/ty.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ use arena::TypedArena;
7070
use std::borrow::{BorrowFrom, Cow};
7171
use std::cell::{Cell, RefCell};
7272
use std::cmp;
73-
use std::fmt::{self, Show};
73+
use std::fmt;
7474
use std::hash::{Hash, Writer, SipHasher, Hasher};
7575
use std::mem;
7676
use std::ops;

src/librustdoc/html/format.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
//! HTML formatting module
1212
//!
13-
//! This module contains a large number of `fmt::String` implementations for
13+
//! This module contains a large number of `fmt::Display` implementations for
1414
//! various types in `rustdoc::clean`. These implementations all currently
1515
//! assume that HTML output is desired, although it may be possible to redesign
1616
//! them in the future to instead emit any format desired.

src/libserialize/json.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1032,7 +1032,7 @@ pub fn as_pretty_json<T>(t: &T) -> AsPrettyJson<T> {
10321032

10331033
impl Json {
10341034
/// Borrow this json object as a pretty object to generate a pretty
1035-
/// representation for it via `Show`.
1035+
/// representation for it via `Display`.
10361036
pub fn pretty(&self) -> PrettyJson {
10371037
PrettyJson { inner: self }
10381038
}
@@ -3540,7 +3540,7 @@ mod tests {
35403540
fn test_hashmap_with_enum_key() {
35413541
use std::collections::HashMap;
35423542
use json;
3543-
#[derive(RustcEncodable, Eq, Hash, PartialEq, RustcDecodable, Show)]
3543+
#[derive(RustcEncodable, Eq, Hash, PartialEq, RustcDecodable, Debug)]
35443544
enum Enum {
35453545
Foo,
35463546
#[allow(dead_code)]

src/libstd/old_path/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ pub trait GenericPath: Clone + GenericPathUnsafe {
228228
/// ```
229229
fn into_vec(self) -> Vec<u8>;
230230

231-
/// Returns an object that implements `Show` for printing paths
231+
/// Returns an object that implements `Display` for printing paths
232232
///
233233
/// # Example
234234
///
@@ -244,7 +244,7 @@ pub trait GenericPath: Clone + GenericPathUnsafe {
244244
Display{ path: self, filename: false }
245245
}
246246

247-
/// Returns an object that implements `Show` for printing filenames
247+
/// Returns an object that implements `Display` for printing filenames
248248
///
249249
/// If there is no filename, nothing will be printed.
250250
///

src/libstd/sys/windows/os.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ impl<'a> Iterator for SplitPaths<'a> {
191191
}
192192
}
193193

194-
#[derive(Show)]
194+
#[derive(Debug)]
195195
pub struct JoinPathsError;
196196

197197
pub fn join_paths<I, T>(paths: I) -> Result<OsString, JoinPathsError>

src/libsyntax/ast.rs

-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ use parse::token;
6464
use ptr::P;
6565

6666
use std::fmt;
67-
use std::fmt::Show;
6867
use std::num::Int;
6968
use std::rc::Rc;
7069
use serialize::{Encodable, Decodable, Encoder, Decoder};

0 commit comments

Comments
 (0)