rust/src/test/run-pass/coerce-reborrow-imm-ptr-rcvr.rs
Patrick Walton 5c3504799d librustc: Remove &const and *const from the language.
They are still present as part of the borrow check.
2013-08-27 18:46:51 -07:00

17 lines
288 B
Rust

struct SpeechMaker {
speeches: uint
}
impl SpeechMaker {
pub fn how_many(&self) -> uint { self.speeches }
}
fn foo(speaker: &SpeechMaker) -> uint {
speaker.how_many() + 33
}
pub fn main() {
let lincoln = SpeechMaker {speeches: 22};
assert_eq!(foo(&lincoln), 55);
}