summaryrefslogtreecommitdiffstats
path: root/tests/ui/coercion/coerce-reborrow-imm-ptr-rcvr.rs
blob: 64a365229cbb77e3438e5e922d7f6d2e86ef9cde (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// 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() {
    let lincoln = SpeechMaker {speeches: 22};
    assert_eq!(foo(&lincoln), 55);
}