]> git.proxmox.com Git - rustc.git/blame - src/test/ui/issues/issue-45510.rs
Update unsuspicious file list
[rustc.git] / src / test / ui / issues / issue-45510.rs
CommitLineData
0731742a
XL
1// Test overloaded resolution of fn_traits.
2// run-pass
3
4#![feature(fn_traits)]
5#![feature(unboxed_closures)]
6
7#[derive(Debug, PartialEq, Eq)]
8struct Ishmael;
9#[derive(Debug, PartialEq, Eq)]
10struct Maybe;
11struct CallMe;
12
13impl FnOnce<(Ishmael,)> for CallMe {
14 type Output = Ishmael;
15 extern "rust-call" fn call_once(self, _args: (Ishmael,)) -> Ishmael {
16 println!("Split your lungs with blood and thunder!");
17 Ishmael
18 }
19}
20
21impl FnOnce<(Maybe,)> for CallMe {
22 type Output = Maybe;
23 extern "rust-call" fn call_once(self, _args: (Maybe,)) -> Maybe {
24 println!("So we just met, and this is crazy");
25 Maybe
26 }
27}
28
29fn main() {
30 assert_eq!(CallMe(Ishmael), Ishmael);
31 assert_eq!(CallMe(Maybe), Maybe);
32}