]> git.lizzy.rs Git - rust.git/blob - src/tools/miri/tests/pass/overloaded-calls-simple.rs
Auto merge of #104915 - weihanglo:update-cargo, r=ehuss
[rust.git] / src / tools / miri / tests / pass / overloaded-calls-simple.rs
1 #![feature(lang_items, unboxed_closures, fn_traits)]
2
3 struct S3 {
4     x: i32,
5     y: i32,
6 }
7
8 impl FnOnce<(i32, i32)> for S3 {
9     type Output = i32;
10     extern "rust-call" fn call_once(self, (z, zz): (i32, i32)) -> i32 {
11         self.x * self.y * z * zz
12     }
13 }
14
15 fn main() {
16     let s = S3 { x: 3, y: 3 };
17     let ans = s(3, 1);
18     assert_eq!(ans, 27);
19 }