From 000be8fe83a854796e55ed92458a7b70cc17c3a2 Mon Sep 17 00:00:00 2001 From: Mazdak Farrokhzad Date: Tue, 18 Sep 2018 02:42:39 +0200 Subject: [PATCH 01/10] dbg!(expr) implementation. --- src/libstd/macros.rs | 118 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 118 insertions(+) mode change 100644 => 100755 src/libstd/macros.rs diff --git a/src/libstd/macros.rs b/src/libstd/macros.rs old mode 100644 new mode 100755 index e60ef46e738b4..8344c73c9bea3 --- a/src/libstd/macros.rs +++ b/src/libstd/macros.rs @@ -220,6 +220,124 @@ macro_rules! eprintln { }) } +/// A macro for quick and dirty debugging with which you can inspect +/// 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 +/// assert_eq!(b, 5); +/// ``` +/// +/// The macro works by using the `Debug` implementation of the type of +/// the given expression to print the value to [stderr] along with the +/// source location of the macro invocation as well as the source code +/// of the expression. +/// +/// Invoking the macro on an expression moves and takes ownership of it +/// before returning the evaluated expression unchanged. If the type +/// of the expression does not implement `Copy` and you don't want +/// to give up ownership, you can instead borrow with `dbg!(&expr)` +/// for some expression `expr`. +/// +/// and should be avoided +/// for longer periods in version control +/// +/// # Stability +/// +/// The exact output printed by this macro should not be relied upon +/// and is subject to future changes. +/// +/// # Panics +/// +/// Panics if writing to `io::stderr` fails. +/// +/// # Further examples +/// +/// With a method call: +/// +/// ```rust +/// #![feature(dbg_macro)] +/// +/// fn foo(n: usize) { +/// if let Some(_) = dbg!(n.checked_sub(4)) { +/// // ... +/// } +/// } +/// +/// foo(3) +/// ``` +/// +/// This prints to [stderr]: +/// +/// ```text,ignore +/// [src/main.rs:4] n.checked_sub(4) = None +/// ``` +/// +/// Naive factorial implementation: +/// +/// ```rust +/// #![feature(dbg_macro)] +/// +/// fn factorial(n: u32) -> u32 { +/// if dbg!(n <= 1) { +/// dbg!(1) +/// } else { +/// dbg!(n * factorial(n - 1)) +/// } +/// } +/// +/// dbg!(factorial(4)); +/// ``` +/// +/// This prints to [stderr]: +/// +/// ```text,ignore +/// [src/main.rs:3] n <= 1 = false +/// [src/main.rs:3] n <= 1 = false +/// [src/main.rs:3] n <= 1 = false +/// [src/main.rs:3] n <= 1 = true +/// [src/main.rs:4] 1 = 1 +/// [src/main.rs:5] n * factorial(n - 1) = 2 +/// [src/main.rs:5] n * factorial(n - 1) = 6 +/// [src/main.rs:5] n * factorial(n - 1) = 24 +/// [src/main.rs:11] factorial(4) = 24 +/// ``` +/// +/// 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); +/// +/// let a = NoCopy(42); +/// let _ = dbg!(a); // <-- `a` is moved here. +/// let _ = dbg!(a); // <-- `a` is moved again; error! +/// ``` +/// +/// [stderr]: https://en.wikipedia.org/wiki/Standard_streams#Standard_error_(stderr) +#[macro_export] +#[unstable(feature = "dbg_macro", issue = "54306")] +macro_rules! dbg { + ($val:expr) => { + // Use of `match` here is intentional because it affects the lifetimes + // of temporaries - https://stackoverflow.com/a/48732525/1063961 + match $val { + tmp => { + eprintln!("[{}:{}] {} = {:#?}", + file!(), line!(), stringify!($val), &tmp); + tmp + } + } + } +} + #[macro_export] #[unstable(feature = "await_macro", issue = "50547")] #[allow_internal_unstable] From cbb81bd8569a59cc4672d7ea1d504d5ee85531a5 Mon Sep 17 00:00:00 2001 From: Mazdak Farrokhzad Date: Tue, 18 Sep 2018 04:25:09 +0200 Subject: [PATCH 02/10] dbg_macro: feature gate + move semantics test. --- .../dbg-macro-feature-gate.rs | 5 +++ .../dbg-macro-feature-gate.stderr | 11 ++++++ .../dbg-macro-move-semantics.nll.stderr | 36 +++++++++++++++++++ .../dbg-macro-move-semantics.rs | 12 +++++++ .../dbg-macro-move-semantics.stderr | 25 +++++++++++++ 5 files changed, 89 insertions(+) create mode 100755 src/test/ui/rfc-2361-dbg-macro/dbg-macro-feature-gate.rs create mode 100644 src/test/ui/rfc-2361-dbg-macro/dbg-macro-feature-gate.stderr create mode 100644 src/test/ui/rfc-2361-dbg-macro/dbg-macro-move-semantics.nll.stderr create mode 100755 src/test/ui/rfc-2361-dbg-macro/dbg-macro-move-semantics.rs create mode 100644 src/test/ui/rfc-2361-dbg-macro/dbg-macro-move-semantics.stderr 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 new file mode 100755 index 0000000000000..b237c6f147bf7 --- /dev/null +++ b/src/test/ui/rfc-2361-dbg-macro/dbg-macro-feature-gate.rs @@ -0,0 +1,5 @@ +// 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 new file mode 100644 index 0000000000000..64df1e196d285 --- /dev/null +++ b/src/test/ui/rfc-2361-dbg-macro/dbg-macro-feature-gate.stderr @@ -0,0 +1,11 @@ +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`. diff --git a/src/test/ui/rfc-2361-dbg-macro/dbg-macro-move-semantics.nll.stderr b/src/test/ui/rfc-2361-dbg-macro/dbg-macro-move-semantics.nll.stderr new file mode 100644 index 0000000000000..baeaad6e58fe5 --- /dev/null +++ b/src/test/ui/rfc-2361-dbg-macro/dbg-macro-move-semantics.nll.stderr @@ -0,0 +1,36 @@ +error[E0382]: use of moved value: `a` + --> $DIR/dbg-macro-move-semantics.rs:11:18 + | +LL | let _ = dbg!(a); + | ------- value moved here +LL | let _ = dbg!(a); + | ^ value used here after move + | + = note: move occurs because `a` has type `NoCopy`, which does not implement the `Copy` trait + = 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]: borrow of moved value: `a` + --> $DIR/dbg-macro-move-semantics.rs:11:18 + | +LL | let _ = dbg!(a); + | ------- value moved here +LL | let _ = dbg!(a); + | ^ value borrowed here after move + | + = note: move occurs because `a` has type `NoCopy`, which does not implement the `Copy` trait + = 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 + | +LL | let _ = dbg!(a); + | ------- value moved here +LL | let _ = dbg!(a); + | ^^^^^^^ value used here after move + | + = note: move occurs because `a` has type `NoCopy`, which does not implement the `Copy` trait + = 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: aborting due to 3 previous errors + +For more information about this error, try `rustc --explain E0382`. diff --git a/src/test/ui/rfc-2361-dbg-macro/dbg-macro-move-semantics.rs b/src/test/ui/rfc-2361-dbg-macro/dbg-macro-move-semantics.rs new file mode 100755 index 0000000000000..bcf508d9af5d7 --- /dev/null +++ b/src/test/ui/rfc-2361-dbg-macro/dbg-macro-move-semantics.rs @@ -0,0 +1,12 @@ +// Test ensuring that `dbg!(expr)` will take ownership of the argument. + +#![feature(dbg_macro)] + +#[derive(Debug)] +struct NoCopy(usize); + +fn main() { + let a = NoCopy(0); + let _ = dbg!(a); + let _ = dbg!(a); +} diff --git a/src/test/ui/rfc-2361-dbg-macro/dbg-macro-move-semantics.stderr b/src/test/ui/rfc-2361-dbg-macro/dbg-macro-move-semantics.stderr new file mode 100644 index 0000000000000..1064317438515 --- /dev/null +++ b/src/test/ui/rfc-2361-dbg-macro/dbg-macro-move-semantics.stderr @@ -0,0 +1,25 @@ +error[E0382]: use of moved value: `a` + --> $DIR/dbg-macro-move-semantics.rs:11:18 + | +LL | let _ = dbg!(a); + | ------- value moved here +LL | let _ = dbg!(a); + | ^ value used here after move + | + = note: move occurs because `a` has type `NoCopy`, which does not implement the `Copy` trait + = 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 + | +LL | let _ = dbg!(a); + | ------- value moved here +LL | let _ = dbg!(a); + | ^^^^^^^ value used here after move + | + = note: move occurs because `a` has type `NoCopy`, which does not implement the `Copy` trait + = 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: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0382`. From 6d0882127120df865debd02a08e4f7642739c58e Mon Sep 17 00:00:00 2001 From: Mazdak Farrokhzad Date: Tue, 18 Sep 2018 04:28:17 +0200 Subject: [PATCH 03/10] dbg_macro: Debug-required test. --- .../dbg-macro-requires-debug.rs | 9 +++++++++ .../dbg-macro-requires-debug.stderr | 15 +++++++++++++++ 2 files changed, 24 insertions(+) create mode 100755 src/test/ui/rfc-2361-dbg-macro/dbg-macro-requires-debug.rs create mode 100644 src/test/ui/rfc-2361-dbg-macro/dbg-macro-requires-debug.stderr diff --git a/src/test/ui/rfc-2361-dbg-macro/dbg-macro-requires-debug.rs b/src/test/ui/rfc-2361-dbg-macro/dbg-macro-requires-debug.rs new file mode 100755 index 0000000000000..8e6f3b226fc1e --- /dev/null +++ b/src/test/ui/rfc-2361-dbg-macro/dbg-macro-requires-debug.rs @@ -0,0 +1,9 @@ +// Test ensuring that `dbg!(expr)` requires the passed type to implement `Debug`. + +#![feature(dbg_macro)] + +struct NotDebug; + +fn main() { + let _: NotDebug = dbg!(NotDebug); +} diff --git a/src/test/ui/rfc-2361-dbg-macro/dbg-macro-requires-debug.stderr b/src/test/ui/rfc-2361-dbg-macro/dbg-macro-requires-debug.stderr new file mode 100644 index 0000000000000..a3b6a1761b991 --- /dev/null +++ b/src/test/ui/rfc-2361-dbg-macro/dbg-macro-requires-debug.stderr @@ -0,0 +1,15 @@ +error[E0277]: `NotDebug` doesn't implement `std::fmt::Debug` + --> $DIR/dbg-macro-requires-debug.rs:8:23 + | +LL | let _: NotDebug = dbg!(NotDebug); + | ^^^^^^^^^^^^^^ `NotDebug` cannot be formatted using `{:?}` + | + = help: the trait `std::fmt::Debug` is not implemented for `NotDebug` + = note: add `#[derive(Debug)]` or manually implement `std::fmt::Debug` + = note: required because of the requirements on the impl of `std::fmt::Debug` for `&NotDebug` + = note: required by `std::fmt::Debug::fmt` + = 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: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. From a9d2f38432045e4cfd8f8f8354f19fb8e55ec7ca Mon Sep 17 00:00:00 2001 From: Mazdak Farrokhzad Date: Tue, 18 Sep 2018 07:00:09 +0200 Subject: [PATCH 04/10] dbg_macro: output tests. --- .../dbg-macro-expected-behavior.rs | 119 ++++++++++++++++++ 1 file changed, 119 insertions(+) create mode 100755 src/test/ui/rfc-2361-dbg-macro/dbg-macro-expected-behavior.rs diff --git a/src/test/ui/rfc-2361-dbg-macro/dbg-macro-expected-behavior.rs b/src/test/ui/rfc-2361-dbg-macro/dbg-macro-expected-behavior.rs new file mode 100755 index 0000000000000..3f4656004e7a5 --- /dev/null +++ b/src/test/ui/rfc-2361-dbg-macro/dbg-macro-expected-behavior.rs @@ -0,0 +1,119 @@ +// run-pass + +// 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; + +#[derive(Copy, Clone, Debug, PartialEq)] +struct Point { + x: T, + y: T, +} + +#[derive(Debug, PartialEq)] +struct NoCopy(usize); + +fn test() { + let a: Unit = dbg!(Unit); + let _: Unit = dbg!(a); + // We can move `a` because it's Copy. + drop(a); + + // `Point` will be faithfully formatted according to `{:#?}`. + let a = Point { x: 42, y: 24 }; + let b: Point = dbg!(Point { x: 42, y: 24 }); // test stringify!(..) + let c: Point = dbg!(b); + // Identity conversion: + assert_eq!(a, b); + assert_eq!(a, c); + // We can move `b` because it's Copy. + drop(b); + + // Test that we can borrow and that successive applications is still identity. + let a = NoCopy(1337); + let b: &NoCopy = dbg!(dbg!(&a)); + assert_eq!(&a, b); + + // Test involving lifetimes of temporaries: + fn f<'a>(x: &'a u8) -> &'a u8 { x } + let a: &u8 = dbg!(f(&42)); + assert_eq!(a, &42); + + // Test side effects: + let mut foo = 41; + assert_eq!(7331, dbg!({ + foo += 1; + eprintln!("before"); + 7331 + })); + assert_eq!(foo, 42); +} + +fn validate_stderr(stderr: Vec) { + assert_eq!(stderr, &[ + ":21] Unit = Unit", + + ":22] a = Unit", + + ":28] Point{x: 42, y: 24,} = Point {", + " x: 42,", + " y: 24", + "}", + + ":29] b = Point {", + " x: 42,", + " y: 24", + "}", + + ":38] &a = NoCopy(", + " 1337", + ")", + + ":38] dbg!(& a) = NoCopy(", + " 1337", + ")", + ":43] f(&42) = 42", + + "before", + ":48] { foo += 1; eprintln!(\"before\"); 7331 } = 7331", + ]); +} + +fn main() { + // The following is a hack to deal with compiletest's inability + // to check the output (to stdout) of run-pass tests. + use std::env; + use std::process::Command; + + let mut args = env::args(); + let prog = args.next().unwrap(); + let child = args.next(); + if let Some("child") = child.as_ref().map(|s| &**s) { + // Only run the test if we've been spawned as 'child' + test() + } else { + // This essentially spawns as 'child' to run the tests + // and then it collects output of stderr and checks the output + // against what we expect. + let out = Command::new(&prog).arg("child").output().unwrap(); + assert!(out.status.success()); + assert!(out.stdout.is_empty()); + + let stderr = String::from_utf8(out.stderr).unwrap(); + let stderr = stderr.lines().map(|mut s| { + if s.starts_with("[") { + // Strip `[` and file path: + s = s.trim_start_matches("["); + assert!(s.starts_with(file!())); + s = s.trim_start_matches(file!()); + } + s.to_owned() + }).collect(); + + validate_stderr(stderr); + } +} From 1d2a1bfa7d0f49444e6ae954a46b0df242a3738d Mon Sep 17 00:00:00 2001 From: Mazdak Farrokhzad Date: Tue, 18 Sep 2018 07:08:26 +0200 Subject: [PATCH 05/10] dbg_macro: notes about VCS and log::debug!(..) --- src/libstd/macros.rs | 8 +++++--- .../ui/rfc-2361-dbg-macro/dbg-macro-expected-behavior.rs | 0 src/test/ui/rfc-2361-dbg-macro/dbg-macro-feature-gate.rs | 0 .../ui/rfc-2361-dbg-macro/dbg-macro-move-semantics.rs | 0 .../ui/rfc-2361-dbg-macro/dbg-macro-requires-debug.rs | 0 5 files changed, 5 insertions(+), 3 deletions(-) mode change 100755 => 100644 src/libstd/macros.rs mode change 100755 => 100644 src/test/ui/rfc-2361-dbg-macro/dbg-macro-expected-behavior.rs mode change 100755 => 100644 src/test/ui/rfc-2361-dbg-macro/dbg-macro-feature-gate.rs mode change 100755 => 100644 src/test/ui/rfc-2361-dbg-macro/dbg-macro-move-semantics.rs mode change 100755 => 100644 src/test/ui/rfc-2361-dbg-macro/dbg-macro-requires-debug.rs diff --git a/src/libstd/macros.rs b/src/libstd/macros.rs old mode 100755 new mode 100644 index 8344c73c9bea3..34b7713ff6ff4 --- a/src/libstd/macros.rs +++ b/src/libstd/macros.rs @@ -243,8 +243,10 @@ macro_rules! eprintln { /// to give up ownership, you can instead borrow with `dbg!(&expr)` /// for some expression `expr`. /// -/// and should be avoided -/// for longer periods in version control +/// Note that the macro is intended as a debugging tool and therefore you +/// should avoid having uses of it in version control for longer periods. +/// Use cases involving debug output that should be added to version control +/// may be better served by macros such as `debug!` from the `log` crate. /// /// # Stability /// @@ -261,7 +263,7 @@ macro_rules! eprintln { /// /// ```rust /// #![feature(dbg_macro)] -/// +/// /// fn foo(n: usize) { /// if let Some(_) = dbg!(n.checked_sub(4)) { /// // ... diff --git a/src/test/ui/rfc-2361-dbg-macro/dbg-macro-expected-behavior.rs b/src/test/ui/rfc-2361-dbg-macro/dbg-macro-expected-behavior.rs old mode 100755 new mode 100644 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 old mode 100755 new mode 100644 diff --git a/src/test/ui/rfc-2361-dbg-macro/dbg-macro-move-semantics.rs b/src/test/ui/rfc-2361-dbg-macro/dbg-macro-move-semantics.rs old mode 100755 new mode 100644 diff --git a/src/test/ui/rfc-2361-dbg-macro/dbg-macro-requires-debug.rs b/src/test/ui/rfc-2361-dbg-macro/dbg-macro-requires-debug.rs old mode 100755 new mode 100644 From 924a69373dd212122c14cbbd60df156ea55761ce Mon Sep 17 00:00:00 2001 From: Mazdak Farrokhzad Date: Thu, 20 Sep 2018 17:51:26 +0200 Subject: [PATCH 06/10] debug_macro: --bless tests. --- .../dbg-macro-move-semantics.nll.stderr | 24 +------------------ 1 file changed, 1 insertion(+), 23 deletions(-) diff --git a/src/test/ui/rfc-2361-dbg-macro/dbg-macro-move-semantics.nll.stderr b/src/test/ui/rfc-2361-dbg-macro/dbg-macro-move-semantics.nll.stderr index baeaad6e58fe5..bf99fef3bbd2f 100644 --- a/src/test/ui/rfc-2361-dbg-macro/dbg-macro-move-semantics.nll.stderr +++ b/src/test/ui/rfc-2361-dbg-macro/dbg-macro-move-semantics.nll.stderr @@ -9,28 +9,6 @@ LL | let _ = dbg!(a); = note: move occurs because `a` has type `NoCopy`, which does not implement the `Copy` trait = 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]: borrow of moved value: `a` - --> $DIR/dbg-macro-move-semantics.rs:11:18 - | -LL | let _ = dbg!(a); - | ------- value moved here -LL | let _ = dbg!(a); - | ^ value borrowed here after move - | - = note: move occurs because `a` has type `NoCopy`, which does not implement the `Copy` trait - = 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 - | -LL | let _ = dbg!(a); - | ------- value moved here -LL | let _ = dbg!(a); - | ^^^^^^^ value used here after move - | - = note: move occurs because `a` has type `NoCopy`, which does not implement the `Copy` trait - = 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: aborting due to 3 previous errors +error: aborting due to previous error For more information about this error, try `rustc --explain E0382`. From b4d6d781a16d9e1a765df5c9884a11095dab27c9 Mon Sep 17 00:00:00 2001 From: Mazdak Farrokhzad Date: Sat, 22 Sep 2018 15:41:47 +0200 Subject: [PATCH 07/10] dbg_macro: // ignore-wasm --- .../dbg-macro-expected-behavior.rs | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/test/ui/rfc-2361-dbg-macro/dbg-macro-expected-behavior.rs b/src/test/ui/rfc-2361-dbg-macro/dbg-macro-expected-behavior.rs index 3f4656004e7a5..8700699b32121 100644 --- a/src/test/ui/rfc-2361-dbg-macro/dbg-macro-expected-behavior.rs +++ b/src/test/ui/rfc-2361-dbg-macro/dbg-macro-expected-behavior.rs @@ -1,4 +1,5 @@ // run-pass +// ignore-wasm // Tests ensuring that `dbg!(expr)` has the expected run-time behavior. // as well as some compile time properties we expect. @@ -55,31 +56,31 @@ fn test() { fn validate_stderr(stderr: Vec) { assert_eq!(stderr, &[ - ":21] Unit = Unit", + ":22] Unit = Unit", - ":22] a = Unit", + ":23] a = Unit", - ":28] Point{x: 42, y: 24,} = Point {", + ":29] Point{x: 42, y: 24,} = Point {", " x: 42,", " y: 24", "}", - ":29] b = Point {", + ":30] b = Point {", " x: 42,", " y: 24", "}", - ":38] &a = NoCopy(", + ":39] &a = NoCopy(", " 1337", ")", - ":38] dbg!(& a) = NoCopy(", + ":39] dbg!(& a) = NoCopy(", " 1337", ")", - ":43] f(&42) = 42", + ":44] f(&42) = 42", "before", - ":48] { foo += 1; eprintln!(\"before\"); 7331 } = 7331", + ":49] { foo += 1; eprintln!(\"before\"); 7331 } = 7331", ]); } From 3006d4ea48100a63278bfeb5f5cc90b017820520 Mon Sep 17 00:00:00 2001 From: Mazdak Farrokhzad Date: Sun, 23 Sep 2018 15:50:11 +0200 Subject: [PATCH 08/10] dbg_macro: more things... --- src/test/ui/rfc-2361-dbg-macro/dbg-macro-expected-behavior.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/test/ui/rfc-2361-dbg-macro/dbg-macro-expected-behavior.rs b/src/test/ui/rfc-2361-dbg-macro/dbg-macro-expected-behavior.rs index 8700699b32121..a1e61bd7230b5 100644 --- a/src/test/ui/rfc-2361-dbg-macro/dbg-macro-expected-behavior.rs +++ b/src/test/ui/rfc-2361-dbg-macro/dbg-macro-expected-behavior.rs @@ -1,5 +1,8 @@ // run-pass // ignore-wasm +// ignore-wasm32 +// ignore-cloudabi no processes +// ignore-emscripten no processes // Tests ensuring that `dbg!(expr)` has the expected run-time behavior. // as well as some compile time properties we expect. From 5184dcc31c918bc69f008561925e63faaf674a2c Mon Sep 17 00:00:00 2001 From: Mazdak Farrokhzad Date: Sun, 23 Sep 2018 15:59:34 +0200 Subject: [PATCH 09/10] dbg_macro: only ignore cloudabi and emscripten --- src/test/ui/rfc-2361-dbg-macro/dbg-macro-expected-behavior.rs | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/test/ui/rfc-2361-dbg-macro/dbg-macro-expected-behavior.rs b/src/test/ui/rfc-2361-dbg-macro/dbg-macro-expected-behavior.rs index a1e61bd7230b5..7211be16ed1aa 100644 --- a/src/test/ui/rfc-2361-dbg-macro/dbg-macro-expected-behavior.rs +++ b/src/test/ui/rfc-2361-dbg-macro/dbg-macro-expected-behavior.rs @@ -1,6 +1,4 @@ // run-pass -// ignore-wasm -// ignore-wasm32 // ignore-cloudabi no processes // ignore-emscripten no processes From e5b9331a863c071954bcfbaa4446888414e87249 Mon Sep 17 00:00:00 2001 From: Mazdak Farrokhzad Date: Sun, 23 Sep 2018 22:48:24 +0200 Subject: [PATCH 10/10] dbg_macro: fix line numbers --- .../dbg-macro-expected-behavior.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/test/ui/rfc-2361-dbg-macro/dbg-macro-expected-behavior.rs b/src/test/ui/rfc-2361-dbg-macro/dbg-macro-expected-behavior.rs index 7211be16ed1aa..f7216c57e42b8 100644 --- a/src/test/ui/rfc-2361-dbg-macro/dbg-macro-expected-behavior.rs +++ b/src/test/ui/rfc-2361-dbg-macro/dbg-macro-expected-behavior.rs @@ -57,31 +57,31 @@ fn test() { fn validate_stderr(stderr: Vec) { assert_eq!(stderr, &[ - ":22] Unit = Unit", + ":23] Unit = Unit", - ":23] a = Unit", + ":24] a = Unit", - ":29] Point{x: 42, y: 24,} = Point {", + ":30] Point{x: 42, y: 24,} = Point {", " x: 42,", " y: 24", "}", - ":30] b = Point {", + ":31] b = Point {", " x: 42,", " y: 24", "}", - ":39] &a = NoCopy(", + ":40] &a = NoCopy(", " 1337", ")", - ":39] dbg!(& a) = NoCopy(", + ":40] dbg!(& a) = NoCopy(", " 1337", ")", - ":44] f(&42) = 42", + ":45] f(&42) = 42", "before", - ":49] { foo += 1; eprintln!(\"before\"); 7331 } = 7331", + ":50] { foo += 1; eprintln!(\"before\"); 7331 } = 7331", ]); }