]> git.lizzy.rs Git - rust.git/blob - src/test/ui/coercion/coerce-reborrow-mut-ptr-rcvr.rs
Auto merge of #103831 - chenyukang:yukang/fix-103751-ice, r=nagisa
[rust.git] / src / test / ui / coercion / coerce-reborrow-mut-ptr-rcvr.rs
1 // run-pass
2 // pretty-expanded FIXME #23616
3
4 struct SpeechMaker {
5     speeches: usize
6 }
7
8 impl SpeechMaker {
9     pub fn talk(&mut self) {
10         self.speeches += 1;
11     }
12 }
13
14 fn give_a_few_speeches(speaker: &mut SpeechMaker) {
15
16     // Here speaker is reborrowed for each call, so we don't get errors
17     // about speaker being moved.
18
19     speaker.talk();
20     speaker.talk();
21     speaker.talk();
22 }
23
24 pub fn main() {
25     let mut lincoln = SpeechMaker {speeches: 22};
26     give_a_few_speeches(&mut lincoln);
27 }