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 --- tests/ui/self/explicit-self-objects-uniq.rs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 tests/ui/self/explicit-self-objects-uniq.rs (limited to 'tests/ui/self/explicit-self-objects-uniq.rs') diff --git a/tests/ui/self/explicit-self-objects-uniq.rs b/tests/ui/self/explicit-self-objects-uniq.rs new file mode 100644 index 000000000..250ea12e5 --- /dev/null +++ b/tests/ui/self/explicit-self-objects-uniq.rs @@ -0,0 +1,21 @@ +// run-pass + +trait Foo { + fn f(self: Box); +} + +struct S { + x: isize +} + +impl Foo for S { + fn f(self: Box) { + assert_eq!(self.x, 3); + } +} + +pub fn main() { + let x = Box::new(S { x: 3 }); + let y = x as Box; + y.f(); +} -- cgit v1.2.3