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 --- .../unboxed-closures-call-sugar-autoderef.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 src/test/ui/unboxed-closures/unboxed-closures-call-sugar-autoderef.rs (limited to 'src/test/ui/unboxed-closures/unboxed-closures-call-sugar-autoderef.rs') diff --git a/src/test/ui/unboxed-closures/unboxed-closures-call-sugar-autoderef.rs b/src/test/ui/unboxed-closures/unboxed-closures-call-sugar-autoderef.rs new file mode 100644 index 000000000..9b8a3f409 --- /dev/null +++ b/src/test/ui/unboxed-closures/unboxed-closures-call-sugar-autoderef.rs @@ -0,0 +1,15 @@ +// run-pass +// Test that the call operator autoderefs when calling a bounded type parameter. + +use std::ops::FnMut; + +fn call_with_2(x: &mut F) -> isize + where F : FnMut(isize) -> isize +{ + x(2) // look ma, no `*` +} + +pub fn main() { + let z = call_with_2(&mut |x| x - 22); + assert_eq!(z, -20); +} -- cgit v1.2.3