Don't parse a plus sign when parsing a function type's return type.
diff --git a/src/path.rs b/src/path.rs
index 39edd11..9ad8e71 100644
--- a/src/path.rs
+++ b/src/path.rs
@@ -295,7 +295,7 @@
impl Synom for ParenthesizedGenericArguments {
named!(parse -> Self, do_parse!(
data: parens!(Punctuated::parse_terminated) >>
- output: syn!(ReturnType) >>
+ output: call!(ReturnType::without_plus) >>
(ParenthesizedGenericArguments {
paren_token: data.0,
inputs: data.1,
diff --git a/src/ty.rs b/src/ty.rs
index fa3900a..e0cbc31 100644
--- a/src/ty.rs
+++ b/src/ty.rs
@@ -394,7 +394,7 @@
variadic: option!(cond_reduce!(inputs.empty_or_trailing(), punct!(...))) >>
(inputs, variadic)
)) >>
- output: syn!(ReturnType) >>
+ output: call!(ReturnType::without_plus) >>
(TypeBareFn {
unsafety: unsafety,
abi: abi,
@@ -483,16 +483,21 @@
));
}
- impl Synom for ReturnType {
- named!(parse -> Self, alt!(
+ impl ReturnType {
+ named!(pub without_plus -> Self, call!(Self::parse, false));
+ named!(parse(allow_plus: bool) -> Self, alt!(
do_parse!(
arrow: punct!(->) >>
- ty: syn!(Type) >>
+ ty: call!(ambig_ty, allow_plus) >>
(ReturnType::Type(arrow, Box::new(ty)))
)
|
epsilon!() => { |_| ReturnType::Default }
));
+ }
+
+ impl Synom for ReturnType {
+ named!(parse -> Self, call!(Self::parse, true));
fn description() -> Option<&'static str> {
Some("return type")