From e161d5cf736f1340f299268163a677c5871af313 Mon Sep 17 00:00:00 2001 From: Steven Fackler Date: Tue, 19 May 2015 21:57:39 -0700 Subject: [PATCH] Stabilize debug builders for 1.2.0 --- src/libcollections/lib.rs | 1 - src/libcore/fmt/builders.rs | 31 +++++++++++-------- src/libcore/fmt/mod.rs | 15 +++------ src/libcoretest/lib.rs | 1 - src/libstd/lib.rs | 1 - .../run-pass/deriving-associated-types.rs | 2 +- 6 files changed, 24 insertions(+), 27 deletions(-) diff --git a/src/libcollections/lib.rs b/src/libcollections/lib.rs index cfdb9053da1..f7e784d3892 100644 --- a/src/libcollections/lib.rs +++ b/src/libcollections/lib.rs @@ -39,7 +39,6 @@ #![feature(str_char)] #![feature(str_words)] #![feature(slice_patterns)] -#![feature(debug_builders)] #![feature(utf8_error)] #![cfg_attr(test, feature(rand, rustc_private, test, hash, collections, collections_drain, collections_range))] diff --git a/src/libcore/fmt/builders.rs b/src/libcore/fmt/builders.rs index c1786dc4c28..32d6aa19c64 100644 --- a/src/libcore/fmt/builders.rs +++ b/src/libcore/fmt/builders.rs @@ -54,6 +54,7 @@ fn write_str(&mut self, mut s: &str) -> fmt::Result { /// /// Constructed by the `Formatter::debug_struct` method. #[must_use] +#[stable(feature = "debug_builders", since = "1.2.0")] pub struct DebugStruct<'a, 'b: 'a> { fmt: &'a mut fmt::Formatter<'b>, result: fmt::Result, @@ -72,7 +73,7 @@ pub fn debug_struct_new<'a, 'b>(fmt: &'a mut fmt::Formatter<'b>, name: &str) impl<'a, 'b: 'a> DebugStruct<'a, 'b> { /// Adds a new field to the generated struct output. - #[unstable(feature = "debug_builders", reason = "method was just created")] + #[stable(feature = "debug_builders", since = "1.2.0")] pub fn field(&mut self, name: &str, value: &fmt::Debug) -> &mut DebugStruct<'a, 'b> { self.result = self.result.and_then(|_| { let prefix = if self.has_fields { @@ -94,7 +95,7 @@ pub fn field(&mut self, name: &str, value: &fmt::Debug) -> &mut DebugStruct<'a, } /// Finishes output and returns any error encountered. - #[unstable(feature = "debug_builders", reason = "method was just created")] + #[stable(feature = "debug_builders", since = "1.2.0")] pub fn finish(&mut self) -> fmt::Result { if self.has_fields { self.result = self.result.and_then(|_| { @@ -117,6 +118,7 @@ fn is_pretty(&self) -> bool { /// /// Constructed by the `Formatter::debug_tuple` method. #[must_use] +#[stable(feature = "debug_builders", since = "1.2.0")] pub struct DebugTuple<'a, 'b: 'a> { fmt: &'a mut fmt::Formatter<'b>, result: fmt::Result, @@ -134,7 +136,7 @@ pub fn debug_tuple_new<'a, 'b>(fmt: &'a mut fmt::Formatter<'b>, name: &str) -> D impl<'a, 'b: 'a> DebugTuple<'a, 'b> { /// Adds a new field to the generated tuple struct output. - #[unstable(feature = "debug_builders", reason = "method was just created")] + #[stable(feature = "debug_builders", since = "1.2.0")] pub fn field(&mut self, value: &fmt::Debug) -> &mut DebugTuple<'a, 'b> { self.result = self.result.and_then(|_| { let (prefix, space) = if self.has_fields { @@ -156,7 +158,7 @@ pub fn field(&mut self, value: &fmt::Debug) -> &mut DebugTuple<'a, 'b> { } /// Finishes output and returns any error encountered. - #[unstable(feature = "debug_builders", reason = "method was just created")] + #[stable(feature = "debug_builders", since = "1.2.0")] pub fn finish(&mut self) -> fmt::Result { if self.has_fields { self.result = self.result.and_then(|_| { @@ -211,6 +213,7 @@ fn is_pretty(&self) -> bool { /// /// Constructed by the `Formatter::debug_set` method. #[must_use] +#[stable(feature = "debug_builders", since = "1.2.0")] pub struct DebugSet<'a, 'b: 'a> { inner: DebugInner<'a, 'b>, } @@ -228,14 +231,14 @@ pub fn debug_set_new<'a, 'b>(fmt: &'a mut fmt::Formatter<'b>) -> DebugSet<'a, 'b impl<'a, 'b: 'a> DebugSet<'a, 'b> { /// Adds a new entry to the set output. - #[unstable(feature = "debug_builders", reason = "method was just created")] + #[stable(feature = "debug_builders", since = "1.2.0")] pub fn entry(&mut self, entry: &fmt::Debug) -> &mut DebugSet<'a, 'b> { self.inner.entry(entry); self } /// Adds the contents of an iterator of entries to the set output. - #[unstable(feature = "debug_builders", reason = "method was just created")] + #[stable(feature = "debug_builders", since = "1.2.0")] pub fn entries(&mut self, entries: I) -> &mut DebugSet<'a, 'b> where D: fmt::Debug, I: IntoIterator { for entry in entries { @@ -245,7 +248,7 @@ pub fn entries(&mut self, entries: I) -> &mut DebugSet<'a, 'b> } /// Finishes output and returns any error encountered. - #[unstable(feature = "debug_builders", reason = "method was just created")] + #[stable(feature = "debug_builders", since = "1.2.0")] pub fn finish(&mut self) -> fmt::Result { self.inner.finish(); self.inner.result.and_then(|_| self.inner.fmt.write_str("}")) @@ -256,6 +259,7 @@ pub fn finish(&mut self) -> fmt::Result { /// /// Constructed by the `Formatter::debug_list` method. #[must_use] +#[stable(feature = "debug_builders", since = "1.2.0")] pub struct DebugList<'a, 'b: 'a> { inner: DebugInner<'a, 'b>, } @@ -273,14 +277,14 @@ pub fn debug_list_new<'a, 'b>(fmt: &'a mut fmt::Formatter<'b>) -> DebugList<'a, impl<'a, 'b: 'a> DebugList<'a, 'b> { /// Adds a new entry to the list output. - #[unstable(feature = "debug_builders", reason = "method was just created")] + #[stable(feature = "debug_builders", since = "1.2.0")] pub fn entry(&mut self, entry: &fmt::Debug) -> &mut DebugList<'a, 'b> { self.inner.entry(entry); self } /// Adds the contents of an iterator of entries to the list output. - #[unstable(feature = "debug_builders", reason = "method was just created")] + #[stable(feature = "debug_builders", since = "1.2.0")] pub fn entries(&mut self, entries: I) -> &mut DebugList<'a, 'b> where D: fmt::Debug, I: IntoIterator { for entry in entries { @@ -290,7 +294,7 @@ pub fn entries(&mut self, entries: I) -> &mut DebugList<'a, 'b> } /// Finishes output and returns any error encountered. - #[unstable(feature = "debug_builders", reason = "method was just created")] + #[stable(feature = "debug_builders", since = "1.2.0")] pub fn finish(&mut self) -> fmt::Result { self.inner.finish(); self.inner.result.and_then(|_| self.inner.fmt.write_str("]")) @@ -301,6 +305,7 @@ pub fn finish(&mut self) -> fmt::Result { /// /// Constructed by the `Formatter::debug_map` method. #[must_use] +#[stable(feature = "debug_builders", since = "1.2.0")] pub struct DebugMap<'a, 'b: 'a> { fmt: &'a mut fmt::Formatter<'b>, result: fmt::Result, @@ -318,7 +323,7 @@ pub fn debug_map_new<'a, 'b>(fmt: &'a mut fmt::Formatter<'b>) -> DebugMap<'a, 'b impl<'a, 'b: 'a> DebugMap<'a, 'b> { /// Adds a new entry to the map output. - #[unstable(feature = "debug_builders", reason = "method was just created")] + #[stable(feature = "debug_builders", since = "1.2.0")] pub fn entry(&mut self, key: &fmt::Debug, value: &fmt::Debug) -> &mut DebugMap<'a, 'b> { self.result = self.result.and_then(|_| { if self.is_pretty() { @@ -336,7 +341,7 @@ pub fn entry(&mut self, key: &fmt::Debug, value: &fmt::Debug) -> &mut DebugMap<' } /// Adds the contents of an iterator of entries to the map output. - #[unstable(feature = "debug_builders", reason = "method was just created")] + #[stable(feature = "debug_builders", since = "1.2.0")] pub fn entries(&mut self, entries: I) -> &mut DebugMap<'a, 'b> where K: fmt::Debug, V: fmt::Debug, I: IntoIterator { for (k, v) in entries { @@ -346,7 +351,7 @@ pub fn entries(&mut self, entries: I) -> &mut DebugMap<'a, 'b> } /// Finishes output and returns any error encountered. - #[unstable(feature = "debug_builders", reason = "method was just created")] + #[stable(feature = "debug_builders", since = "1.2.0")] pub fn finish(&mut self) -> fmt::Result { let prefix = if self.is_pretty() && self.has_fields { "\n" } else { "" }; self.result.and_then(|_| write!(self.fmt, "{}}}", prefix)) diff --git a/src/libcore/fmt/mod.rs b/src/libcore/fmt/mod.rs index 22575f340d7..da873f76d1b 100644 --- a/src/libcore/fmt/mod.rs +++ b/src/libcore/fmt/mod.rs @@ -719,7 +719,6 @@ pub fn precision(&self) -> Option { self.precision } /// # Examples /// /// ```rust - /// # #![feature(debug_builders, core)] /// use std::fmt; /// /// struct Foo { @@ -739,7 +738,7 @@ pub fn precision(&self) -> Option { self.precision } /// // prints "Foo { bar: 10, baz: "Hello World" }" /// println!("{:?}", Foo { bar: 10, baz: "Hello World".to_string() }); /// ``` - #[unstable(feature = "debug_builders", reason = "method was just created")] + #[stable(feature = "debug_builders", since = "1.2.0")] #[inline] pub fn debug_struct<'b>(&'b mut self, name: &str) -> DebugStruct<'b, 'a> { builders::debug_struct_new(self, name) @@ -751,7 +750,6 @@ pub fn debug_struct<'b>(&'b mut self, name: &str) -> DebugStruct<'b, 'a> { /// # Examples /// /// ```rust - /// # #![feature(debug_builders, core)] /// use std::fmt; /// /// struct Foo(i32, String); @@ -768,7 +766,7 @@ pub fn debug_struct<'b>(&'b mut self, name: &str) -> DebugStruct<'b, 'a> { /// // prints "Foo(10, "Hello World")" /// println!("{:?}", Foo(10, "Hello World".to_string())); /// ``` - #[unstable(feature = "debug_builders", reason = "method was just created")] + #[stable(feature = "debug_builders", since = "1.2.0")] #[inline] pub fn debug_tuple<'b>(&'b mut self, name: &str) -> DebugTuple<'b, 'a> { builders::debug_tuple_new(self, name) @@ -780,7 +778,6 @@ pub fn debug_tuple<'b>(&'b mut self, name: &str) -> DebugTuple<'b, 'a> { /// # Examples /// /// ```rust - /// # #![feature(debug_builders, core)] /// use std::fmt; /// /// struct Foo(Vec); @@ -794,7 +791,7 @@ pub fn debug_tuple<'b>(&'b mut self, name: &str) -> DebugTuple<'b, 'a> { /// // prints "[10, 11]" /// println!("{:?}", Foo(vec![10, 11])); /// ``` - #[unstable(feature = "debug_builders", reason = "method was just created")] + #[stable(feature = "debug_builders", since = "1.2.0")] #[inline] pub fn debug_list<'b>(&'b mut self) -> DebugList<'b, 'a> { builders::debug_list_new(self) @@ -806,7 +803,6 @@ pub fn debug_list<'b>(&'b mut self) -> DebugList<'b, 'a> { /// # Examples /// /// ```rust - /// # #![feature(debug_builders, core)] /// use std::fmt; /// /// struct Foo(Vec); @@ -820,7 +816,7 @@ pub fn debug_list<'b>(&'b mut self) -> DebugList<'b, 'a> { /// // prints "{10, 11}" /// println!("{:?}", Foo(vec![10, 11])); /// ``` - #[unstable(feature = "debug_builders", reason = "method was just created")] + #[stable(feature = "debug_builders", since = "1.2.0")] #[inline] pub fn debug_set<'b>(&'b mut self) -> DebugSet<'b, 'a> { builders::debug_set_new(self) @@ -832,7 +828,6 @@ pub fn debug_set<'b>(&'b mut self) -> DebugSet<'b, 'a> { /// # Examples /// /// ```rust - /// # #![feature(debug_builders, core)] /// use std::fmt; /// /// struct Foo(Vec<(String, i32)>); @@ -846,7 +841,7 @@ pub fn debug_set<'b>(&'b mut self) -> DebugSet<'b, 'a> { /// // prints "{"A": 10, "B": 11}" /// println!("{:?}", Foo(vec![("A".to_string(), 10), ("B".to_string(), 11)])); /// ``` - #[unstable(feature = "debug_builders", reason = "method was just created")] + #[stable(feature = "debug_builders", since = "1.2.0")] #[inline] pub fn debug_map<'b>(&'b mut self) -> DebugMap<'b, 'a> { builders::debug_map_new(self) diff --git a/src/libcoretest/lib.rs b/src/libcoretest/lib.rs index 90c1e8b132e..78c7215f550 100644 --- a/src/libcoretest/lib.rs +++ b/src/libcoretest/lib.rs @@ -20,7 +20,6 @@ #![feature(std_misc)] #![feature(libc)] #![feature(hash)] -#![feature(debug_builders)] #![feature(unique)] #![feature(step_by)] #![feature(slice_patterns)] diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs index 1c6a02f1dcf..1ad627cedd6 100644 --- a/src/libstd/lib.rs +++ b/src/libstd/lib.rs @@ -109,7 +109,6 @@ #![feature(box_syntax)] #![feature(collections)] #![feature(core)] -#![feature(debug_builders)] #![feature(into_cow)] #![feature(lang_items)] #![feature(libc)] diff --git a/src/test/run-pass/deriving-associated-types.rs b/src/test/run-pass/deriving-associated-types.rs index 59eb5506c45..632ef5e0c8a 100644 --- a/src/test/run-pass/deriving-associated-types.rs +++ b/src/test/run-pass/deriving-associated-types.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(core, debug_builders)] +#![feature(core)] pub trait DeclaredTrait { type Type;