rust/tests/ui/regions/regions-self-impls.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

21 lines
383 B
Rust
Raw Normal View History

// 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 };
2014-10-15 01:07:11 +00:00
println!("{}", *clam.get_chowder());
clam.get_chowder();
}