From 5e52594f612d6e17728521683ed2516f61afa81e Mon Sep 17 00:00:00 2001 From: Mazdak Farrokhzad Date: Thu, 15 Mar 2018 22:32:23 +0100 Subject: [PATCH 01/11] add DebugStr - a helper for Debug impls" --- src/libcore/fmt/builders.rs | 74 +++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) diff --git a/src/libcore/fmt/builders.rs b/src/libcore/fmt/builders.rs index a1f4c6995dae0..0de664243f61b 100644 --- a/src/libcore/fmt/builders.rs +++ b/src/libcore/fmt/builders.rs @@ -537,3 +537,77 @@ impl<'a, 'b: 'a> DebugMap<'a, 'b> { self.fmt.alternate() } } + +/// A struct to help with [`fmt::Debug`](trait.Debug.html) implementations. +/// +/// This is useful you need to output an unquoted string as part of your +/// [`Debug::fmt`](trait.Debug.html#tymethod.fmt) implementation. +/// +/// The type can be constructed by the +/// [`DebugStr::new`](struct.DebugStr.html#method.new) function. +/// +/// The difference between `&'a str` and `DebugStr<'a>` in a `Debug` context +/// such as `println!("{:?}", )` is that the former will quote the +/// string while the latter will not. In other words, the following holds: +/// +/// ```rust +/// #![feature(debug_str)] +/// use std::fmt::DebugStr; +/// +/// assert_eq!("foo", format!("{:?}", DebugStr::new("foo"))); +/// assert_eq!("\"foo\"", format!("{:?}", "foo")); +/// ``` +/// +/// # Examples +/// +/// In this example we use `DebugStr::new("_")` for a "catch all" match arm. +/// +/// ``` +/// #![feature(debug_str)] +/// use std::fmt::{Debug, Formatter, DebugStr, Result}; +/// +/// struct Arrow<'a, L: 'a, R: 'a>(&'a (L, R)); +/// struct Table<'a, K: 'a, V: 'a>(&'a [(K, V)], V); +/// +/// impl<'a, L: 'a + Debug, R: 'a + Debug> Debug for Arrow<'a, L, R> { +/// fn fmt(&self, fmt: &mut Formatter) -> Result { +/// L::fmt(&(self.0).0, fmt)?; +/// fmt.write_str(" => ")?; +/// R::fmt(&(self.0).1, fmt) +/// } +/// } +/// +/// impl<'a, K: 'a + Debug, V: 'a + Debug> Debug for Table<'a, K, V> { +/// fn fmt(&self, fmt: &mut Formatter) -> Result { +/// fmt.debug_set() +/// .entries(self.0.iter().map(Arrow)) +/// .entry(&Arrow(&(DebugStr::new("_"), &self.1))) +/// .finish() +/// } +/// } +/// +/// let table = (1..3).enumerate().collect::>(); +/// assert_eq!(format!("{:?}", Table(&*table, 0)), +/// "{0 => 1, 1 => 2, _ => 0}"); +/// ``` +#[unstable(feature = "debug_str", issue = "0")] +#[must_use] +#[derive(Copy, Clone)] +pub struct DebugStr<'a>(&'a str); + +#[unstable(feature = "debug_str", issue = "0")] +impl<'a> DebugStr<'a> { + /// Constructs a new `DebugStr` which will output the given string slice + /// unquoted when used in a `Debug` context. See the documentation on the + /// [type](struct.DebugStr.html) for more information. + fn new(string: &'a str) -> Self { + DebugStr(string) + } +} + +#[unstable(feature = "debug_str", issue = "0")] +impl<'a> fmt::Debug for DebugStr<'a> { + fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + fmt.write_str(self.0) + } +} \ No newline at end of file From c251ca778baf8c4f01b61839edde5c094cdea3cd Mon Sep 17 00:00:00 2001 From: Mazdak Farrokhzad Date: Thu, 15 Mar 2018 22:37:38 +0100 Subject: [PATCH 02/11] add DebugStr - get rid of DebugStr::new --- src/libcore/fmt/builders.rs | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-) diff --git a/src/libcore/fmt/builders.rs b/src/libcore/fmt/builders.rs index 0de664243f61b..afb30b8f8e586 100644 --- a/src/libcore/fmt/builders.rs +++ b/src/libcore/fmt/builders.rs @@ -543,9 +543,6 @@ impl<'a, 'b: 'a> DebugMap<'a, 'b> { /// This is useful you need to output an unquoted string as part of your /// [`Debug::fmt`](trait.Debug.html#tymethod.fmt) implementation. /// -/// The type can be constructed by the -/// [`DebugStr::new`](struct.DebugStr.html#method.new) function. -/// /// The difference between `&'a str` and `DebugStr<'a>` in a `Debug` context /// such as `println!("{:?}", )` is that the former will quote the /// string while the latter will not. In other words, the following holds: @@ -554,15 +551,15 @@ impl<'a, 'b: 'a> DebugMap<'a, 'b> { /// #![feature(debug_str)] /// use std::fmt::DebugStr; /// -/// assert_eq!("foo", format!("{:?}", DebugStr::new("foo"))); +/// assert_eq!("foo", format!("{:?}", DebugStr("foo"))); /// assert_eq!("\"foo\"", format!("{:?}", "foo")); /// ``` /// /// # Examples /// -/// In this example we use `DebugStr::new("_")` for a "catch all" match arm. +/// In this example we use `DebugStr("_")` for a "catch all" match arm. /// -/// ``` +/// ```rust /// #![feature(debug_str)] /// use std::fmt::{Debug, Formatter, DebugStr, Result}; /// @@ -581,7 +578,7 @@ impl<'a, 'b: 'a> DebugMap<'a, 'b> { /// fn fmt(&self, fmt: &mut Formatter) -> Result { /// fmt.debug_set() /// .entries(self.0.iter().map(Arrow)) -/// .entry(&Arrow(&(DebugStr::new("_"), &self.1))) +/// .entry(&Arrow(&(DebugStr("_"), &self.1))) /// .finish() /// } /// } @@ -593,17 +590,7 @@ impl<'a, 'b: 'a> DebugMap<'a, 'b> { #[unstable(feature = "debug_str", issue = "0")] #[must_use] #[derive(Copy, Clone)] -pub struct DebugStr<'a>(&'a str); - -#[unstable(feature = "debug_str", issue = "0")] -impl<'a> DebugStr<'a> { - /// Constructs a new `DebugStr` which will output the given string slice - /// unquoted when used in a `Debug` context. See the documentation on the - /// [type](struct.DebugStr.html) for more information. - fn new(string: &'a str) -> Self { - DebugStr(string) - } -} +pub struct DebugStr<'a>(pub &'a str); #[unstable(feature = "debug_str", issue = "0")] impl<'a> fmt::Debug for DebugStr<'a> { From 6a485c6de63e8696a4eb7a0e6b86ddb570e61276 Mon Sep 17 00:00:00 2001 From: Mazdak Farrokhzad Date: Thu, 15 Mar 2018 23:03:33 +0100 Subject: [PATCH 03/11] add DebugStr - s/Arrow/Arm --- src/libcore/fmt/builders.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libcore/fmt/builders.rs b/src/libcore/fmt/builders.rs index afb30b8f8e586..afc7e2e3f61f4 100644 --- a/src/libcore/fmt/builders.rs +++ b/src/libcore/fmt/builders.rs @@ -597,4 +597,4 @@ impl<'a> fmt::Debug for DebugStr<'a> { fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { fmt.write_str(self.0) } -} \ No newline at end of file +} From 399525932ede921c6e4d5d313742f5d75e5fce7f Mon Sep 17 00:00:00 2001 From: Mazdak Farrokhzad Date: Thu, 15 Mar 2018 23:06:29 +0100 Subject: [PATCH 04/11] add DebugStr - s/Arrow/Arm --- src/libcore/fmt/builders.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/libcore/fmt/builders.rs b/src/libcore/fmt/builders.rs index afc7e2e3f61f4..7be770fb266af 100644 --- a/src/libcore/fmt/builders.rs +++ b/src/libcore/fmt/builders.rs @@ -563,10 +563,10 @@ impl<'a, 'b: 'a> DebugMap<'a, 'b> { /// #![feature(debug_str)] /// use std::fmt::{Debug, Formatter, DebugStr, Result}; /// -/// struct Arrow<'a, L: 'a, R: 'a>(&'a (L, R)); +/// struct Arm<'a, L: 'a, R: 'a>(&'a (L, R)); /// struct Table<'a, K: 'a, V: 'a>(&'a [(K, V)], V); /// -/// impl<'a, L: 'a + Debug, R: 'a + Debug> Debug for Arrow<'a, L, R> { +/// impl<'a, L: 'a + Debug, R: 'a + Debug> Debug for Arm<'a, L, R> { /// fn fmt(&self, fmt: &mut Formatter) -> Result { /// L::fmt(&(self.0).0, fmt)?; /// fmt.write_str(" => ")?; @@ -577,8 +577,8 @@ impl<'a, 'b: 'a> DebugMap<'a, 'b> { /// impl<'a, K: 'a + Debug, V: 'a + Debug> Debug for Table<'a, K, V> { /// fn fmt(&self, fmt: &mut Formatter) -> Result { /// fmt.debug_set() -/// .entries(self.0.iter().map(Arrow)) -/// .entry(&Arrow(&(DebugStr("_"), &self.1))) +/// .entries(self.0.iter().map(Arm)) +/// .entry(&Arm(&(DebugStr("_"), &self.1))) /// .finish() /// } /// } From 8dfb75e2b54be2a2b83ef904479a638b069e741d Mon Sep 17 00:00:00 2001 From: Mazdak Farrokhzad Date: Fri, 16 Mar 2018 00:04:05 +0100 Subject: [PATCH 05/11] add DebugStr - actually export DebugStr --- src/libcore/fmt/mod.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/libcore/fmt/mod.rs b/src/libcore/fmt/mod.rs index 67126b496e211..f2d82e40083f7 100644 --- a/src/libcore/fmt/mod.rs +++ b/src/libcore/fmt/mod.rs @@ -42,6 +42,9 @@ pub enum Alignment { #[stable(feature = "debug_builders", since = "1.2.0")] pub use self::builders::{DebugStruct, DebugTuple, DebugSet, DebugList, DebugMap}; +#[unstable(feature = "debug_str", issue = "0")] +pub use self::builders::DebugStr; + #[unstable(feature = "fmt_internals", reason = "internal to format_args!", issue = "0")] #[doc(hidden)] From 77c1f5c491283419d3643c6a6bba1b318c621cbf Mon Sep 17 00:00:00 2001 From: Mazdak Farrokhzad Date: Fri, 16 Mar 2018 00:26:47 +0100 Subject: [PATCH 06/11] add DebugStr - make tidy happy.. --- src/libcore/fmt/builders.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libcore/fmt/builders.rs b/src/libcore/fmt/builders.rs index 7be770fb266af..57a5567b6fc06 100644 --- a/src/libcore/fmt/builders.rs +++ b/src/libcore/fmt/builders.rs @@ -565,7 +565,7 @@ impl<'a, 'b: 'a> DebugMap<'a, 'b> { /// /// struct Arm<'a, L: 'a, R: 'a>(&'a (L, R)); /// struct Table<'a, K: 'a, V: 'a>(&'a [(K, V)], V); -/// +/// /// impl<'a, L: 'a + Debug, R: 'a + Debug> Debug for Arm<'a, L, R> { /// fn fmt(&self, fmt: &mut Formatter) -> Result { /// L::fmt(&(self.0).0, fmt)?; From 9ef9516279ed2601ba2290a6a5de8164bf1652cc Mon Sep 17 00:00:00 2001 From: Mazdak Farrokhzad Date: Fri, 16 Mar 2018 00:44:13 +0100 Subject: [PATCH 07/11] generalize DebugStr to DebugDisplay --- src/libcore/fmt/builders.rs | 32 +++++++++++++++++--------------- src/libcore/fmt/mod.rs | 4 ++-- 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/src/libcore/fmt/builders.rs b/src/libcore/fmt/builders.rs index 57a5567b6fc06..df4da5054629b 100644 --- a/src/libcore/fmt/builders.rs +++ b/src/libcore/fmt/builders.rs @@ -540,28 +540,30 @@ impl<'a, 'b: 'a> DebugMap<'a, 'b> { /// A struct to help with [`fmt::Debug`](trait.Debug.html) implementations. /// -/// This is useful you need to output an unquoted string as part of your +/// This is useful you need to use the `Display` `impl` of a type in a `Debug` +/// context instead of the `Debug` `impl` of the type. One such scenario where +/// this is useful is when you need an unquoted string as part of your /// [`Debug::fmt`](trait.Debug.html#tymethod.fmt) implementation. /// -/// The difference between `&'a str` and `DebugStr<'a>` in a `Debug` context -/// such as `println!("{:?}", )` is that the former will quote the -/// string while the latter will not. In other words, the following holds: +/// The difference between `&'a str` and `DebugDisplay<&'a str>` in a `Debug` +/// context such as `println!("{:?}", )` is that the former will quote +/// the string while the latter will not. In other words, the following holds: /// /// ```rust -/// #![feature(debug_str)] -/// use std::fmt::DebugStr; +/// #![feature(debug_display)] +/// use std::fmt::DebugDisplay; /// -/// assert_eq!("foo", format!("{:?}", DebugStr("foo"))); +/// assert_eq!("foo", format!("{:?}", DebugDisplay("foo"))); /// assert_eq!("\"foo\"", format!("{:?}", "foo")); /// ``` /// /// # Examples /// -/// In this example we use `DebugStr("_")` for a "catch all" match arm. +/// In this example we use `DebugDisplay("_")` for a "catch all" match arm. /// /// ```rust /// #![feature(debug_str)] -/// use std::fmt::{Debug, Formatter, DebugStr, Result}; +/// use std::fmt::{Debug, Formatter, DebugDisplay, Result}; /// /// struct Arm<'a, L: 'a, R: 'a>(&'a (L, R)); /// struct Table<'a, K: 'a, V: 'a>(&'a [(K, V)], V); @@ -578,7 +580,7 @@ impl<'a, 'b: 'a> DebugMap<'a, 'b> { /// fn fmt(&self, fmt: &mut Formatter) -> Result { /// fmt.debug_set() /// .entries(self.0.iter().map(Arm)) -/// .entry(&Arm(&(DebugStr("_"), &self.1))) +/// .entry(&Arm(&(DebugDisplay("_"), &self.1))) /// .finish() /// } /// } @@ -587,14 +589,14 @@ impl<'a, 'b: 'a> DebugMap<'a, 'b> { /// assert_eq!(format!("{:?}", Table(&*table, 0)), /// "{0 => 1, 1 => 2, _ => 0}"); /// ``` -#[unstable(feature = "debug_str", issue = "0")] +#[unstable(feature = "debug_display", issue = "0")] #[must_use] #[derive(Copy, Clone)] -pub struct DebugStr<'a>(pub &'a str); +pub struct DebugDisplay(pub T); -#[unstable(feature = "debug_str", issue = "0")] -impl<'a> fmt::Debug for DebugStr<'a> { +#[unstable(feature = "debug_display", issue = "0")] +impl fmt::Debug for DebugDisplay { fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { - fmt.write_str(self.0) + ::fmt(&self.0, fmt) } } diff --git a/src/libcore/fmt/mod.rs b/src/libcore/fmt/mod.rs index f2d82e40083f7..8a13984d7cb02 100644 --- a/src/libcore/fmt/mod.rs +++ b/src/libcore/fmt/mod.rs @@ -42,8 +42,8 @@ pub enum Alignment { #[stable(feature = "debug_builders", since = "1.2.0")] pub use self::builders::{DebugStruct, DebugTuple, DebugSet, DebugList, DebugMap}; -#[unstable(feature = "debug_str", issue = "0")] -pub use self::builders::DebugStr; +#[unstable(feature = "debug_display", issue = "0")] +pub use self::builders::DebugDisplay; #[unstable(feature = "fmt_internals", reason = "internal to format_args!", issue = "0")] From 5639c6ab42907f7c2eb39d5b8495f3681cd16f3f Mon Sep 17 00:00:00 2001 From: Mazdak Farrokhzad Date: Fri, 16 Mar 2018 03:15:02 +0100 Subject: [PATCH 08/11] add DebugStr - fix feature & export bugs --- src/liballoc/fmt.rs | 2 ++ src/libcore/fmt/builders.rs | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/liballoc/fmt.rs b/src/liballoc/fmt.rs index a092bfb3b0a8a..6be5b0495dffa 100644 --- a/src/liballoc/fmt.rs +++ b/src/liballoc/fmt.rs @@ -527,6 +527,8 @@ pub use core::fmt::Error; pub use core::fmt::{ArgumentV1, Arguments, write}; #[stable(feature = "rust1", since = "1.0.0")] pub use core::fmt::{DebugList, DebugMap, DebugSet, DebugStruct, DebugTuple}; +#[unstable(feature = "debug_display", issue = "0")] +pub use core::fmt::DebugDisplay; use string; diff --git a/src/libcore/fmt/builders.rs b/src/libcore/fmt/builders.rs index df4da5054629b..740e48edcc1fa 100644 --- a/src/libcore/fmt/builders.rs +++ b/src/libcore/fmt/builders.rs @@ -562,7 +562,7 @@ impl<'a, 'b: 'a> DebugMap<'a, 'b> { /// In this example we use `DebugDisplay("_")` for a "catch all" match arm. /// /// ```rust -/// #![feature(debug_str)] +/// #![feature(debug_display)] /// use std::fmt::{Debug, Formatter, DebugDisplay, Result}; /// /// struct Arm<'a, L: 'a, R: 'a>(&'a (L, R)); From 0c28b428e52ef4febf80aed286fcd5094b85733b Mon Sep 17 00:00:00 2001 From: Mazdak Farrokhzad Date: Fri, 16 Mar 2018 03:21:45 +0100 Subject: [PATCH 09/11] add DebugStr - fix feature bug in liballoc --- src/liballoc/lib.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/liballoc/lib.rs b/src/liballoc/lib.rs index b93e128d50819..5294b91616426 100644 --- a/src/liballoc/lib.rs +++ b/src/liballoc/lib.rs @@ -94,6 +94,7 @@ #![feature(dropck_eyepatch)] #![feature(exact_size_is_empty)] #![feature(fmt_internals)] +#![feature(debug_display)] #![feature(from_ref)] #![feature(fundamental)] #![feature(generic_param_attrs)] From 48889949086ac934d13ee1b78a56251d68740777 Mon Sep 17 00:00:00 2001 From: Mazdak Farrokhzad Date: Sun, 18 Mar 2018 08:54:52 +0100 Subject: [PATCH 10/11] rename DebugDisplay -> DisplayAsDebug --- src/liballoc/fmt.rs | 5 +++-- src/liballoc/lib.rs | 2 +- src/libcore/fmt/builders.rs | 30 +++++++++++++++++------------- src/libcore/fmt/mod.rs | 4 ++-- 4 files changed, 23 insertions(+), 18 deletions(-) diff --git a/src/liballoc/fmt.rs b/src/liballoc/fmt.rs index 6be5b0495dffa..f9026517340f0 100644 --- a/src/liballoc/fmt.rs +++ b/src/liballoc/fmt.rs @@ -527,8 +527,9 @@ pub use core::fmt::Error; pub use core::fmt::{ArgumentV1, Arguments, write}; #[stable(feature = "rust1", since = "1.0.0")] pub use core::fmt::{DebugList, DebugMap, DebugSet, DebugStruct, DebugTuple}; -#[unstable(feature = "debug_display", issue = "0")] -pub use core::fmt::DebugDisplay; + +#[unstable(feature = "display_as_debug", issue = "0")] +pub use core::fmt::DisplayAsDebug; use string; diff --git a/src/liballoc/lib.rs b/src/liballoc/lib.rs index 5294b91616426..8532e56b36eb7 100644 --- a/src/liballoc/lib.rs +++ b/src/liballoc/lib.rs @@ -94,7 +94,7 @@ #![feature(dropck_eyepatch)] #![feature(exact_size_is_empty)] #![feature(fmt_internals)] -#![feature(debug_display)] +#![feature(display_as_debug)] #![feature(from_ref)] #![feature(fundamental)] #![feature(generic_param_attrs)] diff --git a/src/libcore/fmt/builders.rs b/src/libcore/fmt/builders.rs index 740e48edcc1fa..096a6d8f266bd 100644 --- a/src/libcore/fmt/builders.rs +++ b/src/libcore/fmt/builders.rs @@ -543,27 +543,31 @@ impl<'a, 'b: 'a> DebugMap<'a, 'b> { /// This is useful you need to use the `Display` `impl` of a type in a `Debug` /// context instead of the `Debug` `impl` of the type. One such scenario where /// this is useful is when you need an unquoted string as part of your -/// [`Debug::fmt`](trait.Debug.html#tymethod.fmt) implementation. +/// [`Debug::fmt`](trait.Debug.html#tymethod.fmt) implementation. As seen +/// below in the example, this can happen when you want to use [`.debug_set()`] +/// methods and friends. +/// +/// [`.debug_set()`]: struct.Formatter.html#method.debug_set /// -/// The difference between `&'a str` and `DebugDisplay<&'a str>` in a `Debug` +/// The difference between `&'a str` and `DisplayAsDebug<&'a str>` in a `Debug` /// context such as `println!("{:?}", )` is that the former will quote /// the string while the latter will not. In other words, the following holds: /// /// ```rust -/// #![feature(debug_display)] -/// use std::fmt::DebugDisplay; +/// #![feature(display_as_debug)] +/// use std::fmt::DisplayAsDebug; /// -/// assert_eq!("foo", format!("{:?}", DebugDisplay("foo"))); +/// assert_eq!("foo", format!("{:?}", DisplayAsDebug("foo"))); /// assert_eq!("\"foo\"", format!("{:?}", "foo")); /// ``` /// /// # Examples /// -/// In this example we use `DebugDisplay("_")` for a "catch all" match arm. +/// In this example we use `DisplayAsDebug("_")` for a "catch all" match arm. /// /// ```rust -/// #![feature(debug_display)] -/// use std::fmt::{Debug, Formatter, DebugDisplay, Result}; +/// #![feature(display_as_debug)] +/// use std::fmt::{Debug, Formatter, DisplayAsDebug, Result}; /// /// struct Arm<'a, L: 'a, R: 'a>(&'a (L, R)); /// struct Table<'a, K: 'a, V: 'a>(&'a [(K, V)], V); @@ -580,7 +584,7 @@ impl<'a, 'b: 'a> DebugMap<'a, 'b> { /// fn fmt(&self, fmt: &mut Formatter) -> Result { /// fmt.debug_set() /// .entries(self.0.iter().map(Arm)) -/// .entry(&Arm(&(DebugDisplay("_"), &self.1))) +/// .entry(&Arm(&(DisplayAsDebug("_"), &self.1))) /// .finish() /// } /// } @@ -589,13 +593,13 @@ impl<'a, 'b: 'a> DebugMap<'a, 'b> { /// assert_eq!(format!("{:?}", Table(&*table, 0)), /// "{0 => 1, 1 => 2, _ => 0}"); /// ``` -#[unstable(feature = "debug_display", issue = "0")] +#[unstable(feature = "display_as_debug", issue = "0")] #[must_use] #[derive(Copy, Clone)] -pub struct DebugDisplay(pub T); +pub struct DisplayAsDebug(pub T); -#[unstable(feature = "debug_display", issue = "0")] -impl fmt::Debug for DebugDisplay { +#[unstable(feature = "display_as_debug", issue = "0")] +impl fmt::Debug for DisplayAsDebug { fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { ::fmt(&self.0, fmt) } diff --git a/src/libcore/fmt/mod.rs b/src/libcore/fmt/mod.rs index 8a13984d7cb02..0f72e449834f7 100644 --- a/src/libcore/fmt/mod.rs +++ b/src/libcore/fmt/mod.rs @@ -42,8 +42,8 @@ pub enum Alignment { #[stable(feature = "debug_builders", since = "1.2.0")] pub use self::builders::{DebugStruct, DebugTuple, DebugSet, DebugList, DebugMap}; -#[unstable(feature = "debug_display", issue = "0")] -pub use self::builders::DebugDisplay; +#[unstable(feature = "display_as_debug", issue = "0")] +pub use self::builders::DisplayAsDebug; #[unstable(feature = "fmt_internals", reason = "internal to format_args!", issue = "0")] From 9f0405034e240dbdc8ed4dc7d8688880a03c6926 Mon Sep 17 00:00:00 2001 From: Mazdak Farrokhzad Date: Sun, 18 Mar 2018 09:00:29 +0100 Subject: [PATCH 11/11] tracking issue for fmt::DisplayAsDebug is #49128 --- src/liballoc/fmt.rs | 2 +- src/libcore/fmt/builders.rs | 4 ++-- src/libcore/fmt/mod.rs | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/liballoc/fmt.rs b/src/liballoc/fmt.rs index f9026517340f0..441584b02bf15 100644 --- a/src/liballoc/fmt.rs +++ b/src/liballoc/fmt.rs @@ -528,7 +528,7 @@ pub use core::fmt::{ArgumentV1, Arguments, write}; #[stable(feature = "rust1", since = "1.0.0")] pub use core::fmt::{DebugList, DebugMap, DebugSet, DebugStruct, DebugTuple}; -#[unstable(feature = "display_as_debug", issue = "0")] +#[unstable(feature = "display_as_debug", issue = "49128")] pub use core::fmt::DisplayAsDebug; use string; diff --git a/src/libcore/fmt/builders.rs b/src/libcore/fmt/builders.rs index 096a6d8f266bd..29a0a4c4e4286 100644 --- a/src/libcore/fmt/builders.rs +++ b/src/libcore/fmt/builders.rs @@ -593,12 +593,12 @@ impl<'a, 'b: 'a> DebugMap<'a, 'b> { /// assert_eq!(format!("{:?}", Table(&*table, 0)), /// "{0 => 1, 1 => 2, _ => 0}"); /// ``` -#[unstable(feature = "display_as_debug", issue = "0")] +#[unstable(feature = "display_as_debug", issue = "49128")] #[must_use] #[derive(Copy, Clone)] pub struct DisplayAsDebug(pub T); -#[unstable(feature = "display_as_debug", issue = "0")] +#[unstable(feature = "display_as_debug", issue = "49128")] impl fmt::Debug for DisplayAsDebug { fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { ::fmt(&self.0, fmt) diff --git a/src/libcore/fmt/mod.rs b/src/libcore/fmt/mod.rs index 0f72e449834f7..d5f5aa48f11e7 100644 --- a/src/libcore/fmt/mod.rs +++ b/src/libcore/fmt/mod.rs @@ -42,7 +42,7 @@ pub enum Alignment { #[stable(feature = "debug_builders", since = "1.2.0")] pub use self::builders::{DebugStruct, DebugTuple, DebugSet, DebugList, DebugMap}; -#[unstable(feature = "display_as_debug", issue = "0")] +#[unstable(feature = "display_as_debug", issue = "49128")] pub use self::builders::DisplayAsDebug; #[unstable(feature = "fmt_internals", reason = "internal to format_args!",