rust/src/test/run-pass/coerce-reborrow-imm-ptr-rcvr.rs

17 lines
306 B
Rust
Raw Normal View History

struct SpeechMaker {
speeches: uint
}
impl SpeechMaker {
pub fn how_many(&const self) -> uint { self.speeches }
}
fn foo(speaker: &const SpeechMaker) -> uint {
speaker.how_many() + 33
}
pub fn main() {
2013-08-17 10:37:42 -05:00
let lincoln = SpeechMaker {speeches: 22};
assert_eq!(foo(&const lincoln), 55);
}