]>
Commit | Line | Data |
---|---|---|
223e47cc LB |
1 | // Copyright 2012 The Rust Project Developers. See the COPYRIGHT |
2 | // file at the top-level directory of this distribution and at | |
3 | // http://rust-lang.org/COPYRIGHT. | |
4 | // | |
5 | // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or | |
6 | // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license | |
7 | // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your | |
8 | // option. This file may not be copied, modified, or distributed | |
9 | // except according to those terms. | |
1a4d82fc | 10 | #![allow(unused_attribute)] |
85aaf69f | 11 | #![feature(custom_attribute)] |
223e47cc LB |
12 | |
13 | struct cat { | |
1a4d82fc | 14 | name: String, |
223e47cc LB |
15 | } |
16 | ||
17 | impl Drop for cat { | |
18 | #[cat_dropper] | |
19 | /** | |
20 | Actually, cats don't always land on their feet when you drop them. | |
21 | */ | |
1a4d82fc JJ |
22 | fn drop(&mut self) { |
23 | println!("{} landed on hir feet", self.name); | |
223e47cc LB |
24 | } |
25 | } | |
26 | ||
27 | #[cat_maker] | |
28 | /** | |
29 | Maybe it should technically be a kitten_maker. | |
30 | */ | |
1a4d82fc | 31 | fn cat(name: String) -> cat { |
223e47cc LB |
32 | cat { |
33 | name: name | |
34 | } | |
35 | } | |
36 | ||
37 | pub fn main() { | |
1a4d82fc | 38 | let _kitty = cat("Spotty".to_string()); |
223e47cc | 39 | } |