From 698f8c2f01ea549d77d7dc3338a12e04c11057b9 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:02:58 +0200 Subject: Adding upstream version 1.64.0+dfsg1. Signed-off-by: Daniel Baumann --- src/test/ui/traits/default-method/auxiliary/xc.rs | 40 +++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 src/test/ui/traits/default-method/auxiliary/xc.rs (limited to 'src/test/ui/traits/default-method/auxiliary/xc.rs') diff --git a/src/test/ui/traits/default-method/auxiliary/xc.rs b/src/test/ui/traits/default-method/auxiliary/xc.rs new file mode 100644 index 000000000..0fb26af80 --- /dev/null +++ b/src/test/ui/traits/default-method/auxiliary/xc.rs @@ -0,0 +1,40 @@ +pub struct Something { pub x: isize } + +pub trait A { + fn f(&self) -> isize; + fn g(&self) -> isize { 10 } + fn h(&self) -> isize { 11 } + fn lurr(x: &Self, y: &Self) -> isize { x.g() + y.h() } +} + + +impl A for isize { + fn f(&self) -> isize { 10 } +} + +impl A for Something { + fn f(&self) -> isize { 10 } +} + +pub trait B { + fn thing(&self, x: T, y: U) -> (T, U) { (x, y) } + fn staticthing(_z: &Self, x: T, y: U) -> (T, U) { (x, y) } +} + +impl B for isize { } +impl B for bool { } + + + +pub trait TestEquality { + fn test_eq(&self, rhs: &Self) -> bool; + fn test_neq(&self, rhs: &Self) -> bool { + !self.test_eq(rhs) + } +} + +impl TestEquality for isize { + fn test_eq(&self, rhs: &isize) -> bool { + *self == *rhs + } +} -- cgit v1.2.3