2012-12-10 17:32:48 -08:00
|
|
|
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
|
|
|
|
// file at the top-level directory of this distribution and at
|
|
|
|
// http://rust-lang.org/COPYRIGHT.
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
|
|
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
|
|
// option. This file may not be copied, modified, or distributed
|
|
|
|
// except according to those terms.
|
|
|
|
|
2012-08-15 18:46:55 -07:00
|
|
|
struct cat {
|
2013-09-16 23:37:54 -07:00
|
|
|
meow: extern "Rust" fn(),
|
|
|
|
}
|
|
|
|
|
|
|
|
fn meow() {
|
2013-09-29 19:23:57 -07:00
|
|
|
error2!("meow")
|
2012-09-05 15:58:43 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
fn cat() -> cat {
|
|
|
|
cat {
|
2013-09-16 23:37:54 -07:00
|
|
|
meow: meow,
|
2012-09-05 15:58:43 -07:00
|
|
|
}
|
2012-06-15 17:32:59 -07:00
|
|
|
}
|
|
|
|
|
2013-01-25 22:46:32 -08:00
|
|
|
struct KittyInfo {kitty: cat}
|
2012-06-15 17:32:59 -07:00
|
|
|
|
|
|
|
// Code compiles and runs successfully if we add a + before the first arg
|
2013-01-25 22:46:32 -08:00
|
|
|
fn nyan(kitty: cat, _kitty_info: KittyInfo) {
|
2012-12-01 15:25:17 -08:00
|
|
|
(kitty.meow)();
|
2012-06-15 17:32:59 -07:00
|
|
|
}
|
|
|
|
|
2013-02-01 19:43:17 -08:00
|
|
|
pub fn main() {
|
2013-08-17 08:37:42 -07:00
|
|
|
let kitty = cat();
|
2013-06-27 17:41:35 -07:00
|
|
|
nyan(kitty, KittyInfo {kitty: kitty});
|
2012-06-17 16:16:41 -07:00
|
|
|
}
|