This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +26
-1
lines changed Expand file tree Collapse file tree 3 files changed +26
-1
lines changed Original file line number Diff line number Diff line change @@ -829,7 +829,6 @@ impl Rewrite for ast::Ty {
829829 }
830830 ast:: TyKind :: Ref ( ref lifetime, ref mt)
831831 | ast:: TyKind :: PinnedRef ( ref lifetime, ref mt) => {
832- // FIXME(pin_ergonomics): correctly format pinned reference syntax
833832 let mut_str = format_mutability ( mt. mutbl ) ;
834833 let mut_len = mut_str. len ( ) ;
835834 let mut result = String :: with_capacity ( 128 ) ;
@@ -863,6 +862,13 @@ impl Rewrite for ast::Ty {
863862 cmnt_lo = lifetime. ident . span . hi ( ) ;
864863 }
865864
865+ if let ast:: TyKind :: PinnedRef ( ..) = self . kind {
866+ result. push_str ( "pin " ) ;
867+ if ast:: Mutability :: Not == mt. mutbl {
868+ result. push_str ( "const " ) ;
869+ }
870+ }
871+
866872 if ast:: Mutability :: Mut == mt. mutbl {
867873 let mut_hi = context. snippet_provider . span_after ( self . span ( ) , "mut" ) ;
868874 let before_mut_span = mk_sp ( cmnt_lo, mut_hi - BytePos :: from_usize ( 3 ) ) ;
Original file line number Diff line number Diff line change 1+ // See #130494
2+
3+ #![ feature( pin_ergonomics) ]
4+ #![ allow( incomplete_features) ]
5+
6+ fn f ( x : & pin const i32 ) { }
7+ fn g < ' a > ( x : & ' a pin const i32 ) { }
8+ fn h < ' a > ( x : & ' a pin
9+ mut i32 ) { }
10+ fn i ( x : & pin mut i32 ) { }
Original file line number Diff line number Diff line change 1+ // See #130494
2+
3+ #![ feature( pin_ergonomics) ]
4+ #![ allow( incomplete_features) ]
5+
6+ fn f ( x : & pin const i32 ) { }
7+ fn g < ' a > ( x : & ' a pin const i32 ) { }
8+ fn h < ' a > ( x : & ' a pin mut i32 ) { }
9+ fn i ( x : & pin mut i32 ) { }
You can’t perform that action at this time.
0 commit comments