2018-08-30 12:18:55 +00:00
|
|
|
//@ run-pass
|
2015-03-22 20:13:15 +00:00
|
|
|
//@ pretty-expanded FIXME #23616
|
|
|
|
|
2013-01-23 01:20:08 +00:00
|
|
|
struct SpeechMaker {
|
2015-03-26 00:06:52 +00:00
|
|
|
speeches: usize
|
2013-01-23 01:20:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
fn talk(x: &mut SpeechMaker) {
|
|
|
|
x.speeches += 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
fn give_a_few_speeches(speaker: &mut SpeechMaker) {
|
|
|
|
|
|
|
|
// Here speaker is reborrowed for each call, so we don't get errors
|
|
|
|
// about speaker being moved.
|
|
|
|
|
|
|
|
talk(speaker);
|
|
|
|
talk(speaker);
|
|
|
|
talk(speaker);
|
|
|
|
}
|
|
|
|
|
2013-02-02 03:43:17 +00:00
|
|
|
pub fn main() {
|
2013-01-23 01:20:08 +00:00
|
|
|
let mut lincoln = SpeechMaker {speeches: 22};
|
|
|
|
give_a_few_speeches(&mut lincoln);
|
|
|
|
}
|