]> git.lizzy.rs Git - rust.git/blob - src/test/ui/coercion/coerce-reborrow-mut-ptr-arg.rs
Rollup merge of #103645 - weihanglo:update-cargo, r=weihanglo
[rust.git] / src / test / ui / coercion / 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 }