stabilize std::dbg!(...)

This commit is contained in:
Mazdak Farrokhzad 2018-12-01 02:54:09 +01:00
parent d09466ceb1
commit f4cde5bc4e
9 changed files with 14 additions and 44 deletions

View 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 test() {
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",
]);
}

View file

@ -1,5 +0,0 @@
// Feature gate test for `dbg!(..)`.
fn main() {
dbg!(1);
}

View file

@ -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`.

View 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

View file

@ -1,7 +1,5 @@
// Test ensuring that `dbg!(expr)` will take ownership of the argument.
#![feature(dbg_macro)]
#[derive(Debug)]
struct NoCopy(usize);

View 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

View file

@ -1,7 +1,5 @@
// Test ensuring that `dbg!(expr)` requires the passed type to implement `Debug`.
#![feature(dbg_macro)]
struct NotDebug;
fn main() {

View 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 `{:?}`