blob: 80b88568e42a192fd343d1d2f83b01e6c9b9d9cf (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
// run-pass
#![allow(non_camel_case_types)]
struct Clam<'a> {
chowder: &'a isize
}
trait get_chowder<'a> {
fn get_chowder(&self) -> &'a isize;
}
impl<'a> get_chowder<'a> for Clam<'a> {
fn get_chowder(&self) -> &'a isize { return self.chowder; }
}
pub fn main() {
let clam = Clam { chowder: &3 };
println!("{}", *clam.get_chowder());
clam.get_chowder();
}
|