diff options
Diffstat (limited to 'tests/ui/rfc-2361-dbg-macro')
6 files changed, 0 insertions, 146 deletions
diff --git a/tests/ui/rfc-2361-dbg-macro/dbg-macro-expected-behavior.rs b/tests/ui/rfc-2361-dbg-macro/dbg-macro-expected-behavior.rs deleted file mode 100644 index 542be3942..000000000 --- a/tests/ui/rfc-2361-dbg-macro/dbg-macro-expected-behavior.rs +++ /dev/null @@ -1,69 +0,0 @@ -// run-pass -// check-run-results - -// Tests ensuring that `dbg!(expr)` has the expected run-time behavior. -// as well as some compile time properties we expect. - -#![allow(dropping_copy_types)] - -#[derive(Copy, Clone, Debug)] -struct Unit; - -#[derive(Copy, Clone, Debug, PartialEq)] -struct Point<T> { - x: T, - y: T, -} - -#[derive(Debug, PartialEq)] -struct NoCopy(usize); - -fn main() { - let a: Unit = dbg!(Unit); - let _: Unit = dbg!(a); - // We can move `a` because it's Copy. - drop(a); - - // `Point<T>` will be faithfully formatted according to `{:#?}`. - let a = Point { x: 42, y: 24 }; - let b: Point<u8> = dbg!(Point { x: 42, y: 24 }); // test stringify!(..) - let c: Point<u8> = dbg!(b); - // Identity conversion: - assert_eq!(a, b); - assert_eq!(a, c); - // We can move `b` because it's Copy. - drop(b); - - // Without parameters works as expected. - let _: () = dbg!(); - - // 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); - - // Test trailing comma: - assert_eq!(("Yeah",), dbg!(("Yeah",))); - - // Test multiple arguments: - assert_eq!((1u8, 2u32), dbg!(1, - 2)); - - // Test multiple arguments + trailing comma: - assert_eq!((1u8, 2u32, "Yeah"), dbg!(1u8, 2u32, - "Yeah",)); -} diff --git a/tests/ui/rfc-2361-dbg-macro/dbg-macro-expected-behavior.run.stderr b/tests/ui/rfc-2361-dbg-macro/dbg-macro-expected-behavior.run.stderr deleted file mode 100644 index a20a6062c..000000000 --- a/tests/ui/rfc-2361-dbg-macro/dbg-macro-expected-behavior.run.stderr +++ /dev/null @@ -1,28 +0,0 @@ -[$DIR/dbg-macro-expected-behavior.rs:22] Unit = Unit -[$DIR/dbg-macro-expected-behavior.rs:23] a = Unit -[$DIR/dbg-macro-expected-behavior.rs:29] Point { x: 42, y: 24 } = Point { - x: 42, - y: 24, -} -[$DIR/dbg-macro-expected-behavior.rs:30] b = Point { - x: 42, - y: 24, -} -[$DIR/dbg-macro-expected-behavior.rs:38] -[$DIR/dbg-macro-expected-behavior.rs:42] &a = NoCopy( - 1337, -) -[$DIR/dbg-macro-expected-behavior.rs:42] dbg!(& a) = NoCopy( - 1337, -) -[$DIR/dbg-macro-expected-behavior.rs:47] f(&42) = 42 -before -[$DIR/dbg-macro-expected-behavior.rs:52] { foo += 1; eprintln!("before"); 7331 } = 7331 -[$DIR/dbg-macro-expected-behavior.rs:60] ("Yeah",) = ( - "Yeah", -) -[$DIR/dbg-macro-expected-behavior.rs:63] 1 = 1 -[$DIR/dbg-macro-expected-behavior.rs:63] 2 = 2 -[$DIR/dbg-macro-expected-behavior.rs:67] 1u8 = 1 -[$DIR/dbg-macro-expected-behavior.rs:67] 2u32 = 2 -[$DIR/dbg-macro-expected-behavior.rs:67] "Yeah" = "Yeah" diff --git a/tests/ui/rfc-2361-dbg-macro/dbg-macro-move-semantics.rs b/tests/ui/rfc-2361-dbg-macro/dbg-macro-move-semantics.rs deleted file mode 100644 index 9f3c567b6..000000000 --- a/tests/ui/rfc-2361-dbg-macro/dbg-macro-move-semantics.rs +++ /dev/null @@ -1,10 +0,0 @@ -// Test ensuring that `dbg!(expr)` will take ownership of the argument. - -#[derive(Debug)] -struct NoCopy(usize); - -fn main() { - let a = NoCopy(0); - let _ = dbg!(a); - let _ = dbg!(a); //~ ERROR use of moved value -} diff --git a/tests/ui/rfc-2361-dbg-macro/dbg-macro-move-semantics.stderr b/tests/ui/rfc-2361-dbg-macro/dbg-macro-move-semantics.stderr deleted file mode 100644 index e97fdcce1..000000000 --- a/tests/ui/rfc-2361-dbg-macro/dbg-macro-move-semantics.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error[E0382]: use of moved value: `a` - --> $DIR/dbg-macro-move-semantics.rs:9:18 - | -LL | let a = NoCopy(0); - | - move occurs because `a` has type `NoCopy`, which does not implement the `Copy` trait -LL | let _ = dbg!(a); - | ------- value moved here -LL | let _ = dbg!(a); - | ^ value used here after move - | - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0382`. diff --git a/tests/ui/rfc-2361-dbg-macro/dbg-macro-requires-debug.rs b/tests/ui/rfc-2361-dbg-macro/dbg-macro-requires-debug.rs deleted file mode 100644 index f2fb62d76..000000000 --- a/tests/ui/rfc-2361-dbg-macro/dbg-macro-requires-debug.rs +++ /dev/null @@ -1,7 +0,0 @@ -// Test ensuring that `dbg!(expr)` requires the passed type to implement `Debug`. - -struct NotDebug; - -fn main() { - let _: NotDebug = dbg!(NotDebug); //~ ERROR `NotDebug` doesn't implement `Debug` -} diff --git a/tests/ui/rfc-2361-dbg-macro/dbg-macro-requires-debug.stderr b/tests/ui/rfc-2361-dbg-macro/dbg-macro-requires-debug.stderr deleted file mode 100644 index ce165e646..000000000 --- a/tests/ui/rfc-2361-dbg-macro/dbg-macro-requires-debug.stderr +++ /dev/null @@ -1,18 +0,0 @@ -error[E0277]: `NotDebug` doesn't implement `Debug` - --> $DIR/dbg-macro-requires-debug.rs:6:23 - | -LL | let _: NotDebug = dbg!(NotDebug); - | ^^^^^^^^^^^^^^ `NotDebug` cannot be formatted using `{:?}` - | - = help: the trait `Debug` is not implemented for `NotDebug` - = note: add `#[derive(Debug)]` to `NotDebug` or manually `impl Debug for NotDebug` - = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `dbg` (in Nightly builds, run with -Z macro-backtrace for more info) -help: consider annotating `NotDebug` with `#[derive(Debug)]` - | -LL + #[derive(Debug)] -LL | struct NotDebug; - | - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0277`. |