From 64d98f8ee037282c35007b64c2649055c56af1db Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:19:03 +0200 Subject: Merging upstream version 1.68.2+dfsg1. Signed-off-by: Daniel Baumann --- tests/ui/derives/derive-Debug-use-ufcs-tuple.rs | 32 +++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 tests/ui/derives/derive-Debug-use-ufcs-tuple.rs (limited to 'tests/ui/derives/derive-Debug-use-ufcs-tuple.rs') diff --git a/tests/ui/derives/derive-Debug-use-ufcs-tuple.rs b/tests/ui/derives/derive-Debug-use-ufcs-tuple.rs new file mode 100644 index 000000000..5f786769f --- /dev/null +++ b/tests/ui/derives/derive-Debug-use-ufcs-tuple.rs @@ -0,0 +1,32 @@ +// run-pass +#![allow(warnings)] + +#[derive(Debug)] +pub struct Foo(pub T); + +use std::fmt; + +impl Field for T {} +impl Finish for T {} +impl Dt for &mut fmt::Formatter<'_> {} + +pub trait Field { + fn field(&self, _: impl Sized) { + panic!("got into field"); + } +} +pub trait Finish { + fn finish(&self) -> Result<(), std::fmt::Error> { + panic!("got into finish"); + } +} +pub trait Dt { + fn debug_tuple(&self, _: &str) { + panic!("got into debug_tuple"); + } +} + +fn main() { + let foo = Foo(()); + assert_eq!("Foo(())", format!("{:?}", foo)); +} -- cgit v1.2.3