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/consts/fn_trait_refs.rs | 77 ------------------------------------- 1 file changed, 77 deletions(-) delete mode 100644 src/test/ui/consts/fn_trait_refs.rs (limited to 'src/test/ui/consts/fn_trait_refs.rs') diff --git a/src/test/ui/consts/fn_trait_refs.rs b/src/test/ui/consts/fn_trait_refs.rs deleted file mode 100644 index b50749297..000000000 --- a/src/test/ui/consts/fn_trait_refs.rs +++ /dev/null @@ -1,77 +0,0 @@ -// check-pass - -#![feature(const_fn_trait_ref_impls)] -#![feature(fn_traits)] -#![feature(unboxed_closures)] -#![feature(const_trait_impl)] -#![feature(const_mut_refs)] -#![feature(const_cmp)] -#![feature(const_refs_to_cell)] - -use std::marker::Destruct; - -const fn tester_fn(f: T) -> T::Output -where - T: ~const Fn<()> + ~const Destruct, -{ - f() -} - -const fn tester_fn_mut(mut f: T) -> T::Output -where - T: ~const FnMut<()> + ~const Destruct, -{ - f() -} - -const fn tester_fn_once(f: T) -> T::Output -where - T: ~const FnOnce<()>, -{ - f() -} - -const fn test_fn(mut f: T) -> (T::Output, T::Output, T::Output) -where - T: ~const Fn<()> + ~const Destruct, -{ - ( - // impl const Fn for &F - tester_fn(&f), - // impl const FnMut for &F - tester_fn_mut(&f), - // impl const FnOnce for &F - tester_fn_once(&f), - ) -} - -const fn test_fn_mut(mut f: T) -> (T::Output, T::Output) -where - T: ~const FnMut<()> + ~const Destruct, -{ - ( - // impl const FnMut for &mut F - tester_fn_mut(&mut f), - // impl const FnOnce for &mut F - tester_fn_once(&mut f), - ) -} -const fn test(i: i32) -> i32 { - i + 1 -} - -fn main() { - const fn one() -> i32 { - 1 - }; - const fn two() -> i32 { - 2 - }; - const _: () = { - let test_one = test_fn(one); - assert!(test_one == (1, 1, 1)); - - let test_two = test_fn_mut(two); - assert!(test_two == (2, 2)); - }; -} -- cgit v1.2.3