]> git.proxmox.com Git - rustc.git/blob - src/test/ui/issues/issue-3904.rs
New upstream version 1.49.0+dfsg1
[rustc.git] / src / test / ui / issues / issue-3904.rs
1 // run-pass
2 fn example_err(prog: &str, arg: &str) {
3 println!("{}: {}", prog, arg)
4 }
5
6 fn exit<F>(print: F, prog: &str, arg: &str) where F: FnOnce(&str, &str) {
7 print(prog, arg);
8 }
9
10 struct X<F> where F: FnOnce(&str, &str) {
11 err: F,
12 }
13
14 impl<F> X<F> where F: FnOnce(&str, &str) {
15 pub fn boom(self) {
16 exit(self.err, "prog", "arg");
17 }
18 }
19
20 pub fn main(){
21 let val = X {
22 err: example_err,
23 };
24 val.boom();
25 }