]> git.lizzy.rs Git - rust.git/commitdiff
stabilize std::dbg!(...)
authorMazdak Farrokhzad <twingoow@gmail.com>
Sat, 1 Dec 2018 01:54:09 +0000 (02:54 +0100)
committerMazdak Farrokhzad <twingoow@gmail.com>
Sat, 1 Dec 2018 01:54:09 +0000 (02:54 +0100)
src/libstd/macros.rs
src/test/ui/rfc-2361-dbg-macro/dbg-macro-expected-behavior.rs
src/test/ui/rfc-2361-dbg-macro/dbg-macro-feature-gate.rs [deleted file]
src/test/ui/rfc-2361-dbg-macro/dbg-macro-feature-gate.stderr [deleted file]
src/test/ui/rfc-2361-dbg-macro/dbg-macro-move-semantics.nll.stderr
src/test/ui/rfc-2361-dbg-macro/dbg-macro-move-semantics.rs
src/test/ui/rfc-2361-dbg-macro/dbg-macro-move-semantics.stderr
src/test/ui/rfc-2361-dbg-macro/dbg-macro-requires-debug.rs
src/test/ui/rfc-2361-dbg-macro/dbg-macro-requires-debug.stderr

index 0995ab3c373ca19fc84b82db8b2950de194e78b2..94827d2a0355f93bc89f409f240ede21d1ca4db5 100644 (file)
@@ -224,11 +224,9 @@ macro_rules! eprintln {
 /// the value of a given expression. An example:
 ///
 /// ```rust
-/// #![feature(dbg_macro)]
-///
 /// let a = 2;
 /// let b = dbg!(a * 2) + 1;
-/// //      ^-- prints: [src/main.rs:4] a * 2 = 4
+/// //      ^-- prints: [src/main.rs:2] a * 2 = 4
 /// assert_eq!(b, 5);
 /// ```
 ///
@@ -262,8 +260,6 @@ macro_rules! eprintln {
 /// With a method call:
 ///
 /// ```rust
-/// #![feature(dbg_macro)]
-///
 /// fn foo(n: usize) {
 ///     if let Some(_) = dbg!(n.checked_sub(4)) {
 ///         // ...
@@ -282,8 +278,6 @@ macro_rules! eprintln {
 /// Naive factorial implementation:
 ///
 /// ```rust
-/// #![feature(dbg_macro)]
-///
 /// fn factorial(n: u32) -> u32 {
 ///     if dbg!(n <= 1) {
 ///         dbg!(1)
@@ -312,8 +306,6 @@ macro_rules! eprintln {
 /// The `dbg!(..)` macro moves the input:
 ///
 /// ```compile_fail
-/// #![feature(dbg_macro)]
-///
 /// /// A wrapper around `usize` which importantly is not Copyable.
 /// #[derive(Debug)]
 /// struct NoCopy(usize);
@@ -325,7 +317,7 @@ macro_rules! eprintln {
 ///
 /// [stderr]: https://en.wikipedia.org/wiki/Standard_streams#Standard_error_(stderr)
 #[macro_export]
-#[unstable(feature = "dbg_macro", issue = "54306")]
+#[stable(feature = "dbg_macro", since = "1.32.0")]
 macro_rules! dbg {
     ($val:expr) => {
         // Use of `match` here is intentional because it affects the lifetimes
index f7216c57e42b8fd678afdfd02f97bfabb12fffcb..3d24f49ad75096b9ed13a4ba977c22d3b9b13bff 100644 (file)
@@ -5,8 +5,6 @@
 // Tests ensuring that `dbg!(expr)` has the expected run-time behavior.
 // as well as some compile time properties we expect.
 
-#![feature(dbg_macro)]
-
 #[derive(Copy, Clone, Debug)]
 struct Unit;
 
@@ -57,31 +55,31 @@ fn f<'a>(x: &'a u8) -> &'a u8 { x }
 
 fn validate_stderr(stderr: Vec<String>) {
     assert_eq!(stderr, &[
-        ":23] Unit = Unit",
+        ":21] Unit = Unit",
 
-        ":24] a = Unit",
+        ":22] a = Unit",
 
-        ":30] Point{x: 42, y: 24,} = Point {",
+        ":28] Point{x: 42, y: 24,} = Point {",
         "    x: 42,",
         "    y: 24",
         "}",
 
-        ":31] b = Point {",
+        ":29] b = Point {",
         "    x: 42,",
         "    y: 24",
         "}",
 
-        ":40] &a = NoCopy(",
+        ":38] &a = NoCopy(",
         "    1337",
         ")",
 
-        ":40] dbg!(& a) = NoCopy(",
+        ":38] dbg!(& a) = NoCopy(",
         "    1337",
         ")",
-        ":45] f(&42) = 42",
+        ":43] f(&42) = 42",
 
         "before",
-        ":50] { foo += 1; eprintln!(\"before\"); 7331 } = 7331",
+        ":48] { foo += 1; eprintln!(\"before\"); 7331 } = 7331",
     ]);
 }
 
diff --git a/src/test/ui/rfc-2361-dbg-macro/dbg-macro-feature-gate.rs b/src/test/ui/rfc-2361-dbg-macro/dbg-macro-feature-gate.rs
deleted file mode 100644 (file)
index b237c6f..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-// Feature gate test for `dbg!(..)`.
-
-fn main() {
-    dbg!(1);
-}
diff --git a/src/test/ui/rfc-2361-dbg-macro/dbg-macro-feature-gate.stderr b/src/test/ui/rfc-2361-dbg-macro/dbg-macro-feature-gate.stderr
deleted file mode 100644 (file)
index 64df1e1..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-error[E0658]: macro dbg! is unstable (see issue #54306)
-  --> $DIR/dbg-macro-feature-gate.rs:4:5
-   |
-LL |     dbg!(1);
-   |     ^^^^^^^^
-   |
-   = help: add #![feature(dbg_macro)] to the crate attributes to enable
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0658`.
index bf99fef3bbd2f415cfd104807c905ca2a0f2e91b..218a1d5b5fd12758158125012f9478d484803991 100644 (file)
@@ -1,5 +1,5 @@
 error[E0382]: use of moved value: `a`
-  --> $DIR/dbg-macro-move-semantics.rs:11:18
+  --> $DIR/dbg-macro-move-semantics.rs:9:18
    |
 LL |     let _ = dbg!(a);
    |             ------- value moved here
index bcf508d9af5d73790861d305a2daee37db3e811c..06a23ea1767b09a6c609cfb84752479d93ce1069 100644 (file)
@@ -1,7 +1,5 @@
 // Test ensuring that `dbg!(expr)` will take ownership of the argument.
 
-#![feature(dbg_macro)]
-
 #[derive(Debug)]
 struct NoCopy(usize);
 
index 1064317438515a8cfb705e8c1cd804267f4812bb..cfc318c1cd0f3961f95df652f25f2a6819f3ca2f 100644 (file)
@@ -1,5 +1,5 @@
 error[E0382]: use of moved value: `a`
-  --> $DIR/dbg-macro-move-semantics.rs:11:18
+  --> $DIR/dbg-macro-move-semantics.rs:9:18
    |
 LL |     let _ = dbg!(a);
    |             ------- value moved here
@@ -10,7 +10,7 @@ LL |     let _ = dbg!(a);
    = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
 
 error[E0382]: use of moved value: `a`
-  --> $DIR/dbg-macro-move-semantics.rs:11:13
+  --> $DIR/dbg-macro-move-semantics.rs:9:13
    |
 LL |     let _ = dbg!(a);
    |             ------- value moved here
index 8e6f3b226fc1ea0a9a50f35fd18a914fb2be6015..365e62c80867356df6df5fd17cc92c26e9bf64b8 100644 (file)
@@ -1,7 +1,5 @@
 // Test ensuring that `dbg!(expr)` requires the passed type to implement `Debug`.
 
-#![feature(dbg_macro)]
-
 struct NotDebug;
 
 fn main() {
index a3b6a1761b991a07a64db899eeb1ee5a51e05ab6..ecab673953d6d6c30bf442365fb36ec946af3d8b 100644 (file)
@@ -1,5 +1,5 @@
 error[E0277]: `NotDebug` doesn't implement `std::fmt::Debug`
-  --> $DIR/dbg-macro-requires-debug.rs:8:23
+  --> $DIR/dbg-macro-requires-debug.rs:6:23
    |
 LL |     let _: NotDebug = dbg!(NotDebug);
    |                       ^^^^^^^^^^^^^^ `NotDebug` cannot be formatted using `{:?}`