2018-08-30 12:18:55 +00:00
|
|
|
// run-pass
|
2018-08-31 13:02:01 +00:00
|
|
|
#![allow(non_camel_case_types)]
|
|
|
|
|
2013-12-10 07:16:18 +00:00
|
|
|
struct Clam<'a> {
|
2015-03-26 00:06:52 +00:00
|
|
|
chowder: &'a isize
|
2013-02-12 00:33:31 +00:00
|
|
|
}
|
2012-04-01 21:28:30 +00:00
|
|
|
|
2013-12-10 07:16:18 +00:00
|
|
|
trait get_chowder<'a> {
|
2015-03-26 00:06:52 +00:00
|
|
|
fn get_chowder(&self) -> &'a isize;
|
2012-07-11 22:00:40 +00:00
|
|
|
}
|
|
|
|
|
2013-12-10 07:16:18 +00:00
|
|
|
impl<'a> get_chowder<'a> for Clam<'a> {
|
2015-03-26 00:06:52 +00:00
|
|
|
fn get_chowder(&self) -> &'a isize { return self.chowder; }
|
2012-03-16 01:13:12 +00:00
|
|
|
}
|
|
|
|
|
2013-02-02 03:43:17 +00:00
|
|
|
pub fn main() {
|
2013-01-26 06:46:32 +00:00
|
|
|
let clam = Clam { chowder: &3 };
|
2014-10-15 01:07:11 +00:00
|
|
|
println!("{}", *clam.get_chowder());
|
2012-03-23 18:37:10 +00:00
|
|
|
clam.get_chowder();
|
2012-03-16 01:13:12 +00:00
|
|
|
}
|