File tree Expand file tree Collapse file tree 2 files changed +12
-12
lines changed
Expand file tree Collapse file tree 2 files changed +12
-12
lines changed Original file line number Diff line number Diff line change @@ -1046,13 +1046,16 @@ pub(crate) mod parsing {
10461046 let mut params = Punctuated :: new ( ) ;
10471047 loop {
10481048 let lookahead = input. lookahead1 ( ) ;
1049- params. push_value ( if lookahead. peek ( Lifetime ) || lookahead. peek ( Ident ) {
1050- input. parse :: < CapturedParam > ( ) ?
1051- } else if lookahead. peek ( Token ! [ >] ) {
1052- break ;
1053- } else {
1054- return Err ( lookahead. error ( ) ) ;
1055- } ) ;
1049+ params. push_value (
1050+ if lookahead. peek ( Lifetime ) || lookahead. peek ( Ident ) || input. peek ( Token ! [ Self ] )
1051+ {
1052+ input. parse :: < CapturedParam > ( ) ?
1053+ } else if lookahead. peek ( Token ! [ >] ) {
1054+ break ;
1055+ } else {
1056+ return Err ( lookahead. error ( ) ) ;
1057+ } ,
1058+ ) ;
10561059 let lookahead = input. lookahead1 ( ) ;
10571060 params. push_punct ( if lookahead. peek ( Token ! [ , ] ) {
10581061 input. parse :: < Token ! [ , ] > ( ) ?
@@ -1079,8 +1082,8 @@ pub(crate) mod parsing {
10791082 let lookahead = input. lookahead1 ( ) ;
10801083 if lookahead. peek ( Lifetime ) {
10811084 input. parse ( ) . map ( CapturedParam :: Lifetime )
1082- } else if lookahead. peek ( Ident ) {
1083- input. parse ( ) . map ( CapturedParam :: Ident )
1085+ } else if lookahead. peek ( Ident ) || input . peek ( Token ! [ Self ] ) {
1086+ input. call ( Ident :: parse_any ) . map ( CapturedParam :: Ident )
10841087 } else {
10851088 Err ( lookahead. error ( ) )
10861089 }
Original file line number Diff line number Diff line change @@ -19,9 +19,6 @@ const REVISION: &str = "86d69c705a552236a622eee3fdea94bf13c5f102";
1919
2020#[ rustfmt:: skip]
2121static EXCLUDE_FILES : & [ & str ] = & [
22- // TODO: self capture: `impl Sized + use<Self>`
23- "tests/ui/impl-trait/precise-capturing/self-capture.rs" ,
24-
2522 // TODO: non-lifetime binders: `where for<'a, T> &'a Struct<T>: Trait`
2623 // https://github.com/dtolnay/syn/issues/1435
2724 "src/tools/rustfmt/tests/source/issue_5721.rs" ,
You can’t perform that action at this time.
0 commit comments