File tree Expand file tree Collapse file tree 1 file changed +70
-0
lines changed Expand file tree Collapse file tree 1 file changed +70
-0
lines changed Original file line number Diff line number Diff line change 1+ // check-pass
2+
3+ use std:: fmt:: { self , Display } ;
4+
5+ struct Mutex ;
6+
7+ impl Mutex {
8+ fn lock ( & self ) -> MutexGuard {
9+ MutexGuard ( self )
10+ }
11+ }
12+
13+ struct MutexGuard < ' a > ( & ' a Mutex ) ;
14+
15+ impl < ' a > Drop for MutexGuard < ' a > {
16+ fn drop ( & mut self ) {
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
19+ // of scope.
20+ }
21+ }
22+
23+ impl < ' a > MutexGuard < ' a > {
24+ fn write_fmt ( & self , _args : fmt:: Arguments ) { }
25+ }
26+
27+ impl < ' a > Display for MutexGuard < ' a > {
28+ fn fmt ( & self , _formatter : & mut fmt:: Formatter ) -> fmt:: Result {
29+ Ok ( ( ) )
30+ }
31+ }
32+
33+ fn main ( ) {
34+ let _write = {
35+ let out = Mutex ;
36+ let mutex = Mutex ;
37+ write ! ( out. lock( ) , "{}" , mutex. lock( ) ) /* no semicolon */
38+ } ;
39+
40+ let _writeln = {
41+ let out = Mutex ;
42+ let mutex = Mutex ;
43+ writeln ! ( out. lock( ) , "{}" , mutex. lock( ) ) /* no semicolon */
44+ } ;
45+
46+ let _print = {
47+ let mutex = Mutex ;
48+ print ! ( "{}" , mutex. lock( ) ) /* no semicolon */
49+ } ;
50+
51+ let _println = {
52+ let mutex = Mutex ;
53+ println ! ( "{}" , mutex. lock( ) ) /* no semicolon */
54+ } ;
55+
56+ let _eprint = {
57+ let mutex = Mutex ;
58+ eprint ! ( "{}" , mutex. lock( ) ) /* no semicolon */
59+ } ;
60+
61+ let _eprintln = {
62+ let mutex = Mutex ;
63+ eprintln ! ( "{}" , mutex. lock( ) ) /* no semicolon */
64+ } ;
65+
66+ let _panic = {
67+ let mutex = Mutex ;
68+ panic ! ( "{}" , mutex. lock( ) ) /* no semicolon */
69+ } ;
70+ }
You can’t perform that action at this time.
0 commit comments