Skip to content

Commit 4888994

Browse files
committed
rename DebugDisplay -> DisplayAsDebug
1 parent 0c28b42 commit 4888994

File tree

4 files changed

+23
-18
lines changed

4 files changed

+23
-18
lines changed

src/liballoc/fmt.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -527,8 +527,9 @@ pub use core::fmt::Error;
527527
pub use core::fmt::{ArgumentV1, Arguments, write};
528528
#[stable(feature = "rust1", since = "1.0.0")]
529529
pub use core::fmt::{DebugList, DebugMap, DebugSet, DebugStruct, DebugTuple};
530-
#[unstable(feature = "debug_display", issue = "0")]
531-
pub use core::fmt::DebugDisplay;
530+
531+
#[unstable(feature = "display_as_debug", issue = "0")]
532+
pub use core::fmt::DisplayAsDebug;
532533

533534
use string;
534535

src/liballoc/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@
9494
#![feature(dropck_eyepatch)]
9595
#![feature(exact_size_is_empty)]
9696
#![feature(fmt_internals)]
97-
#![feature(debug_display)]
97+
#![feature(display_as_debug)]
9898
#![feature(from_ref)]
9999
#![feature(fundamental)]
100100
#![feature(generic_param_attrs)]

src/libcore/fmt/builders.rs

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -543,27 +543,31 @@ impl<'a, 'b: 'a> DebugMap<'a, 'b> {
543543
/// This is useful you need to use the `Display` `impl` of a type in a `Debug`
544544
/// context instead of the `Debug` `impl` of the type. One such scenario where
545545
/// this is useful is when you need an unquoted string as part of your
546-
/// [`Debug::fmt`](trait.Debug.html#tymethod.fmt) implementation.
546+
/// [`Debug::fmt`](trait.Debug.html#tymethod.fmt) implementation. As seen
547+
/// below in the example, this can happen when you want to use [`.debug_set()`]
548+
/// methods and friends.
549+
///
550+
/// [`.debug_set()`]: struct.Formatter.html#method.debug_set
547551
///
548-
/// The difference between `&'a str` and `DebugDisplay<&'a str>` in a `Debug`
552+
/// The difference between `&'a str` and `DisplayAsDebug<&'a str>` in a `Debug`
549553
/// context such as `println!("{:?}", <value>)` is that the former will quote
550554
/// the string while the latter will not. In other words, the following holds:
551555
///
552556
/// ```rust
553-
/// #![feature(debug_display)]
554-
/// use std::fmt::DebugDisplay;
557+
/// #![feature(display_as_debug)]
558+
/// use std::fmt::DisplayAsDebug;
555559
///
556-
/// assert_eq!("foo", format!("{:?}", DebugDisplay("foo")));
560+
/// assert_eq!("foo", format!("{:?}", DisplayAsDebug("foo")));
557561
/// assert_eq!("\"foo\"", format!("{:?}", "foo"));
558562
/// ```
559563
///
560564
/// # Examples
561565
///
562-
/// In this example we use `DebugDisplay("_")` for a "catch all" match arm.
566+
/// In this example we use `DisplayAsDebug("_")` for a "catch all" match arm.
563567
///
564568
/// ```rust
565-
/// #![feature(debug_display)]
566-
/// use std::fmt::{Debug, Formatter, DebugDisplay, Result};
569+
/// #![feature(display_as_debug)]
570+
/// use std::fmt::{Debug, Formatter, DisplayAsDebug, Result};
567571
///
568572
/// struct Arm<'a, L: 'a, R: 'a>(&'a (L, R));
569573
/// struct Table<'a, K: 'a, V: 'a>(&'a [(K, V)], V);
@@ -580,7 +584,7 @@ impl<'a, 'b: 'a> DebugMap<'a, 'b> {
580584
/// fn fmt(&self, fmt: &mut Formatter) -> Result {
581585
/// fmt.debug_set()
582586
/// .entries(self.0.iter().map(Arm))
583-
/// .entry(&Arm(&(DebugDisplay("_"), &self.1)))
587+
/// .entry(&Arm(&(DisplayAsDebug("_"), &self.1)))
584588
/// .finish()
585589
/// }
586590
/// }
@@ -589,13 +593,13 @@ impl<'a, 'b: 'a> DebugMap<'a, 'b> {
589593
/// assert_eq!(format!("{:?}", Table(&*table, 0)),
590594
/// "{0 => 1, 1 => 2, _ => 0}");
591595
/// ```
592-
#[unstable(feature = "debug_display", issue = "0")]
596+
#[unstable(feature = "display_as_debug", issue = "0")]
593597
#[must_use]
594598
#[derive(Copy, Clone)]
595-
pub struct DebugDisplay<T>(pub T);
599+
pub struct DisplayAsDebug<T>(pub T);
596600

597-
#[unstable(feature = "debug_display", issue = "0")]
598-
impl<T: fmt::Display> fmt::Debug for DebugDisplay<T> {
601+
#[unstable(feature = "display_as_debug", issue = "0")]
602+
impl<T: fmt::Display> fmt::Debug for DisplayAsDebug<T> {
599603
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
600604
<T as fmt::Display>::fmt(&self.0, fmt)
601605
}

src/libcore/fmt/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ pub enum Alignment {
4242
#[stable(feature = "debug_builders", since = "1.2.0")]
4343
pub use self::builders::{DebugStruct, DebugTuple, DebugSet, DebugList, DebugMap};
4444

45-
#[unstable(feature = "debug_display", issue = "0")]
46-
pub use self::builders::DebugDisplay;
45+
#[unstable(feature = "display_as_debug", issue = "0")]
46+
pub use self::builders::DisplayAsDebug;
4747

4848
#[unstable(feature = "fmt_internals", reason = "internal to format_args!",
4949
issue = "0")]

0 commit comments

Comments
 (0)