]> git.proxmox.com Git - rustc.git/blob - src/test/run-pass/coerce/coerce-reborrow-mut-ptr-arg.rs
New upstream version 1.37.0+dfsg1
[rustc.git] / src / test / run-pass / coerce / coerce-reborrow-mut-ptr-arg.rs
1 // run-pass
2 // pretty-expanded FIXME #23616
3
4 struct SpeechMaker {
5 speeches: usize
6 }
7
8 fn talk(x: &mut SpeechMaker) {
9 x.speeches += 1;
10 }
11
12 fn give_a_few_speeches(speaker: &mut SpeechMaker) {
13
14 // Here speaker is reborrowed for each call, so we don't get errors
15 // about speaker being moved.
16
17 talk(speaker);
18 talk(speaker);
19 talk(speaker);
20 }
21
22 pub fn main() {
23 let mut lincoln = SpeechMaker {speeches: 22};
24 give_a_few_speeches(&mut lincoln);
25 }