3 use std::fmt::{self, Display};
8 fn lock(&self) -> MutexGuard {
13 struct MutexGuard<'a>(&'a Mutex);
15 impl<'a> Drop for MutexGuard<'a> {
17 // Empty but this is a necessary part of the repro. Otherwise borrow
18 // checker is fine with 'a dangling at the time that MutexGuard goes out
26 fn write_fmt(&self, _args: fmt::Arguments) {}
29 impl<'a> Display for MutexGuard<'a> {
30 fn fmt(&self, _formatter: &mut fmt::Formatter) -> fmt::Result {
36 // FIXME(dtolnay): We actually want both of these to work. I think it's
37 // sadly unimplementable today though.
41 write!(Out, "{}", mutex.lock()) /* no semicolon */
42 //~^ ERROR `mutex` does not live long enough
47 writeln!(Out, "{}", mutex.lock()) /* no semicolon */
48 //~^ ERROR `mutex` does not live long enough