File tree Expand file tree Collapse file tree 3 files changed +46
-0
lines changed Expand file tree Collapse file tree 3 files changed +46
-0
lines changed Original file line number Diff line number Diff line change @@ -2395,6 +2395,33 @@ fn rewrite_explicit_self(
2395
2395
) ?) ,
2396
2396
}
2397
2397
}
2398
+ ast:: SelfKind :: Pinned ( lt, m) => {
2399
+ let mut_str = m. ptr_str ( ) ;
2400
+ match lt {
2401
+ Some ( ref l) => {
2402
+ let lifetime_str = l. rewrite_result (
2403
+ context,
2404
+ Shape :: legacy ( context. config . max_width ( ) , Indent :: empty ( ) ) ,
2405
+ ) ?;
2406
+ Ok ( combine_strs_with_missing_comments (
2407
+ context,
2408
+ param_attrs,
2409
+ & format ! ( "&{lifetime_str} pin {mut_str} self" ) ,
2410
+ span,
2411
+ shape,
2412
+ !has_multiple_attr_lines,
2413
+ ) ?)
2414
+ }
2415
+ None => Ok ( combine_strs_with_missing_comments (
2416
+ context,
2417
+ param_attrs,
2418
+ & format ! ( "&pin {mut_str} self" ) ,
2419
+ span,
2420
+ shape,
2421
+ !has_multiple_attr_lines,
2422
+ ) ?) ,
2423
+ }
2424
+ }
2398
2425
ast:: SelfKind :: Explicit ( ref ty, mutability) => {
2399
2426
let type_str = ty. rewrite_result (
2400
2427
context,
Original file line number Diff line number Diff line change @@ -8,3 +8,13 @@ fn g<'a>(x: & 'a pin const i32) {}
8
8
fn h < ' a > ( x : & ' a pin
9
9
mut i32 ) { }
10
10
fn i ( x : & pin mut i32 ) { }
11
+
12
+ struct Foo ;
13
+
14
+ impl Foo {
15
+ fn f ( & pin const self ) { }
16
+ fn g < ' a > ( & ' a pin const self ) { }
17
+ fn h < ' a > ( & ' a pin
18
+ mut self ) { }
19
+ fn i ( & pin mut self ) { }
20
+ }
Original file line number Diff line number Diff line change @@ -7,3 +7,12 @@ fn f(x: &pin const i32) {}
7
7
fn g < ' a > ( x : & ' a pin const i32 ) { }
8
8
fn h < ' a > ( x : & ' a pin mut i32 ) { }
9
9
fn i ( x : & pin mut i32 ) { }
10
+
11
+ struct Foo ;
12
+
13
+ impl Foo {
14
+ fn f ( & pin const self ) { }
15
+ fn g < ' a > ( & ' a pin const self ) { }
16
+ fn h < ' a > ( & ' a pin mut self ) { }
17
+ fn i ( & pin mut self ) { }
18
+ }
You can’t perform that action at this time.
0 commit comments