Skip to content

Commit f6aee2b

Browse files
stepanchegfacebook-github-bot
authored andcommitted
Remove feature box_patterns from starlark_derive
Reviewed By: bobyangyf Differential Revision: D41091269 fbshipit-source-id: a0bc3199666a7420e680c81c80d8687f7ae86452
1 parent ff12696 commit f6aee2b

File tree

2 files changed

+10
-12
lines changed

2 files changed

+10
-12
lines changed

starlark_derive/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
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
2625
extern crate proc_macro;

starlark_derive/src/module/parse/fun.rs

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff 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",

0 commit comments

Comments
 (0)