File tree Expand file tree Collapse file tree 2 files changed +10
-12
lines changed Expand file tree Collapse file tree 2 files changed +10
-12
lines changed Original file line number Diff line number Diff line change 2020#![ cfg_attr( feature = "gazebo_lint" , feature( plugin) ) ]
2121#![ cfg_attr( feature = "gazebo_lint" , allow( deprecated) ) ] // :(
2222#![ cfg_attr( feature = "gazebo_lint" , plugin( gazebo_lint) ) ]
23- #![ feature( box_patterns) ]
2423
2524#[ allow( unused_extern_crates) ] // proc_macro is very special
2625extern crate proc_macro;
Original file line number Diff line number Diff line change @@ -570,12 +570,15 @@ fn parse_arg(
570570
571571 let span = x. span ( ) ;
572572 match x {
573- FnArg :: Typed ( PatType {
574- attrs,
575- pat : box Pat :: Ident ( ident) ,
576- ty : box ty,
577- ..
578- } ) => {
573+ FnArg :: Typed ( PatType { attrs, pat, ty, .. } ) => {
574+ let ident = if let Pat :: Ident ( ident) = * pat {
575+ ident
576+ } else {
577+ return Err ( syn:: Error :: new (
578+ pat. span ( ) ,
579+ "Function parameter pattern must be identifier" ,
580+ ) ) ;
581+ } ;
579582 if let Some ( heap) = is_heap ( & ident. ident , & ty) ? {
580583 if this {
581584 return Err ( syn:: Error :: new (
@@ -672,15 +675,11 @@ fn parse_arg(
672675 mutable : ident. mutability . is_some ( ) ,
673676 name : ident. ident ,
674677 pass_style,
675- ty,
678+ ty : * ty ,
676679 default : param_attrs. default ,
677680 source : StarArgSource :: Unknown ,
678681 } ) )
679682 }
680- FnArg :: Typed ( PatType { .. } ) => Err ( syn:: Error :: new (
681- span,
682- "Function parameter pattern must be identifier" ,
683- ) ) ,
684683 FnArg :: Receiver ( ..) => Err ( syn:: Error :: new (
685684 span,
686685 "Function cannot have `self` parameters" ,
You can’t perform that action at this time.
0 commit comments