2018-08-30 14:18:55 +02:00
|
|
|
// run-pass
|
2015-03-22 13:13:15 -07:00
|
|
|
// pretty-expanded FIXME #23616
|
|
|
|
|
2013-01-22 17:20:08 -08:00
|
|
|
struct SpeechMaker {
|
2015-03-25 17:06:52 -07:00
|
|
|
speeches: usize
|
2013-01-22 17:20:08 -08:00
|
|
|
}
|
|
|
|
|
2013-05-31 15:17:22 -07:00
|
|
|
impl SpeechMaker {
|
|
|
|
pub fn talk(&mut self) {
|
2013-01-22 17:20:08 -08:00
|
|
|
self.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.
|
|
|
|
|
|
|
|
speaker.talk();
|
|
|
|
speaker.talk();
|
|
|
|
speaker.talk();
|
|
|
|
}
|
|
|
|
|
2013-02-01 19:43:17 -08:00
|
|
|
pub fn main() {
|
2013-01-22 17:20:08 -08:00
|
|
|
let mut lincoln = SpeechMaker {speeches: 22};
|
|
|
|
give_a_few_speeches(&mut lincoln);
|
|
|
|
}
|