From 62c92f30cf02fc56b8a774c77097f1111dc2f4ea Mon Sep 17 00:00:00 2001 From: Kivooeo Date: Thu, 24 Jul 2025 17:45:27 +0500 Subject: moved 35 tests to organized locations --- tests/ui/fn_traits/closure-trait-impl-14959.rs | 54 ++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 tests/ui/fn_traits/closure-trait-impl-14959.rs (limited to 'tests/ui/fn_traits') diff --git a/tests/ui/fn_traits/closure-trait-impl-14959.rs b/tests/ui/fn_traits/closure-trait-impl-14959.rs new file mode 100644 index 00000000000..57af1207ff9 --- /dev/null +++ b/tests/ui/fn_traits/closure-trait-impl-14959.rs @@ -0,0 +1,54 @@ +//@ check-pass + +#![feature(fn_traits, unboxed_closures)] + +use std::ops::Fn; + +trait Response { fn dummy(&self) { } } +trait Request { fn dummy(&self) { } } +trait Ingot { + fn enter(&mut self, _: &mut R, _: &mut S, a: &mut Alloy) -> Status; +} + +#[allow(dead_code)] +struct HelloWorld; + +struct SendFile; +struct Alloy; +enum Status { + Continue +} + +impl Alloy { + fn find(&self) -> Option { + None + } +} + +impl<'b> Fn<(&'b mut (dyn Response + 'b),)> for SendFile { + extern "rust-call" fn call(&self, (_res,): (&'b mut (dyn Response + 'b),)) {} +} + +impl<'b> FnMut<(&'b mut (dyn Response + 'b),)> for SendFile { + extern "rust-call" fn call_mut(&mut self, (_res,): (&'b mut (dyn Response+'b),)) { + self.call((_res,)) + } +} + +impl<'b> FnOnce<(&'b mut (dyn Response + 'b),)> for SendFile { + type Output = (); + + extern "rust-call" fn call_once(self, (_res,): (&'b mut (dyn Response+'b),)) { + self.call((_res,)) + } +} + +impl Ingot for HelloWorld { + fn enter(&mut self, _req: &mut Rq, res: &mut Rs, alloy: &mut Alloy) -> Status { + let send_file = alloy.find::().unwrap(); + send_file(res); + Status::Continue + } +} + +fn main() {} -- cgit 1.4.1-3-g733a5