From 218caa410aa38c29984be31a5229b9fa717560ee Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:19:13 +0200 Subject: Merging upstream version 1.68.2+dfsg1. Signed-off-by: Daniel Baumann --- .../dbg-macro-expected-behavior.rs | 67 ---------------------- .../dbg-macro-expected-behavior.run.stderr | 28 --------- .../rfc-2361-dbg-macro/dbg-macro-move-semantics.rs | 10 ---- .../dbg-macro-move-semantics.stderr | 19 ------ .../rfc-2361-dbg-macro/dbg-macro-requires-debug.rs | 7 --- .../dbg-macro-requires-debug.stderr | 17 ------ 6 files changed, 148 deletions(-) delete mode 100644 src/test/ui/rfc-2361-dbg-macro/dbg-macro-expected-behavior.rs delete mode 100644 src/test/ui/rfc-2361-dbg-macro/dbg-macro-expected-behavior.run.stderr delete mode 100644 src/test/ui/rfc-2361-dbg-macro/dbg-macro-move-semantics.rs delete mode 100644 src/test/ui/rfc-2361-dbg-macro/dbg-macro-move-semantics.stderr delete mode 100644 src/test/ui/rfc-2361-dbg-macro/dbg-macro-requires-debug.rs delete mode 100644 src/test/ui/rfc-2361-dbg-macro/dbg-macro-requires-debug.stderr (limited to 'src/test/ui/rfc-2361-dbg-macro') 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 deleted file mode 100644 index 04d924a9a..000000000 --- a/src/test/ui/rfc-2361-dbg-macro/dbg-macro-expected-behavior.rs +++ /dev/null @@ -1,67 +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. - -#[derive(Copy, Clone, Debug)] -struct Unit; - -#[derive(Copy, Clone, Debug, PartialEq)] -struct Point { - 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` 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); - - // 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/src/test/ui/rfc-2361-dbg-macro/dbg-macro-expected-behavior.run.stderr b/src/test/ui/rfc-2361-dbg-macro/dbg-macro-expected-behavior.run.stderr deleted file mode 100644 index 49d72158e..000000000 --- a/src/test/ui/rfc-2361-dbg-macro/dbg-macro-expected-behavior.run.stderr +++ /dev/null @@ -1,28 +0,0 @@ -[$DIR/dbg-macro-expected-behavior.rs:20] Unit = Unit -[$DIR/dbg-macro-expected-behavior.rs:21] a = Unit -[$DIR/dbg-macro-expected-behavior.rs:27] Point { x: 42, y: 24 } = Point { - x: 42, - y: 24, -} -[$DIR/dbg-macro-expected-behavior.rs:28] b = Point { - x: 42, - y: 24, -} -[$DIR/dbg-macro-expected-behavior.rs:36] -[$DIR/dbg-macro-expected-behavior.rs:40] &a = NoCopy( - 1337, -) -[$DIR/dbg-macro-expected-behavior.rs:40] dbg!(& a) = NoCopy( - 1337, -) -[$DIR/dbg-macro-expected-behavior.rs:45] f(&42) = 42 -before -[$DIR/dbg-macro-expected-behavior.rs:50] { foo += 1; eprintln!("before"); 7331 } = 7331 -[$DIR/dbg-macro-expected-behavior.rs:58] ("Yeah",) = ( - "Yeah", -) -[$DIR/dbg-macro-expected-behavior.rs:61] 1 = 1 -[$DIR/dbg-macro-expected-behavior.rs:61] 2 = 2 -[$DIR/dbg-macro-expected-behavior.rs:65] 1u8 = 1 -[$DIR/dbg-macro-expected-behavior.rs:65] 2u32 = 2 -[$DIR/dbg-macro-expected-behavior.rs:65] "Yeah" = "Yeah" 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 deleted file mode 100644 index 9f3c567b6..000000000 --- a/src/test/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/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 deleted file mode 100644 index 06699b947..000000000 --- a/src/test/ui/rfc-2361-dbg-macro/dbg-macro-move-semantics.stderr +++ /dev/null @@ -1,19 +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 - | -help: borrow this binding in the pattern to avoid moving the value - --> $SRC_DIR/std/src/macros.rs:LL:COL - | -LL | ref tmp => { - | +++ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0382`. 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 deleted file mode 100644 index f2fb62d76..000000000 --- a/src/test/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/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 deleted file mode 100644 index d8b5a9e63..000000000 --- a/src/test/ui/rfc-2361-dbg-macro/dbg-macro-requires-debug.stderr +++ /dev/null @@ -1,17 +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)] - | - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0277`. -- cgit v1.2.3