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 --- src/test/ui/functions-closures/closure-reform.rs | 56 ------------------------ 1 file changed, 56 deletions(-) delete mode 100644 src/test/ui/functions-closures/closure-reform.rs (limited to 'src/test/ui/functions-closures/closure-reform.rs') diff --git a/src/test/ui/functions-closures/closure-reform.rs b/src/test/ui/functions-closures/closure-reform.rs deleted file mode 100644 index 0bb6159ff..000000000 --- a/src/test/ui/functions-closures/closure-reform.rs +++ /dev/null @@ -1,56 +0,0 @@ -// run-pass -#![allow(unused_variables)] -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -fn call_it(f: F) - where F : FnOnce(String) -> String -{ - println!("{}", f("Fred".to_string())) -} - -fn call_a_thunk(f: F) where F: FnOnce() { - f(); -} - -fn call_this(f: F) where F: FnOnce(&str) + Send { - f("Hello!"); -} - -fn call_bare(f: fn(&str)) { - f("Hello world!") -} - -fn call_bare_again(f: extern "Rust" fn(&str)) { - f("Goodbye world!") -} - -pub fn main() { - // Procs - - let greeting = "Hello ".to_string(); - call_it(|s| { - format!("{}{}", greeting, s) - }); - - let greeting = "Goodbye ".to_string(); - call_it(|s| format!("{}{}", greeting, s)); - - let greeting = "How's life, ".to_string(); - call_it(|s: String| -> String { - format!("{}{}", greeting, s) - }); - - // Closures - - call_a_thunk(|| println!("Hello world!")); - - call_this(|s| println!("{}", s)); - - // External functions - - fn foo(s: &str) {} - call_bare(foo); - - call_bare_again(foo); -} -- cgit v1.2.3