rust/tests/ui/coercion/coerce-reborrow-imm-ptr-rcvr.rs

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

19 lines
304 B
Rust
Raw Normal View History

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