diff --git a/codegen/build.rs b/codegen/build.rs index bd563ff6..3cdb104d 100644 --- a/codegen/build.rs +++ b/codegen/build.rs @@ -8,8 +8,8 @@ use yansi::Color::{Red, Yellow, Blue, White}; use version_check::{supports_features, is_min_version, is_min_date}; // Specifies the minimum nightly version needed to compile Rocket's codegen. -const MIN_DATE: &'static str = "2017-12-22"; -const MIN_VERSION: &'static str = "1.24.0-nightly"; +const MIN_DATE: &'static str = "2018-04-03"; +const MIN_VERSION: &'static str = "1.27.0-nightly"; fn main() { let ok_channel = supports_features(); diff --git a/codegen/src/parser/function.rs b/codegen/src/parser/function.rs index 295ae2d1..c185a596 100644 --- a/codegen/src/parser/function.rs +++ b/codegen/src/parser/function.rs @@ -8,18 +8,14 @@ pub struct Function(Spanned<(Ident, FnDecl)>); impl Function { pub fn from(annotated: &Annotatable) -> Result { - let inner = match *annotated { - Annotatable::Item(ref item) => match item.node { - ItemKind::Fn(ref decl, ..) => { - span((item.ident, decl.clone().into_inner()), item.span) - } - _ => return Err(item.span) - }, - Annotatable::TraitItem(ref item) => return Err(item.span), - Annotatable::ImplItem(ref item) => return Err(item.span), - }; + if let Annotatable::Item(ref item) = *annotated { + if let ItemKind::Fn(ref decl, ..) = item.node { + let inner = (item.ident, decl.clone().into_inner()); + return Ok(Function(span(inner, item.span))); + } + } - Ok(Function(inner)) + Err(annotated.span()) } pub fn ident(&self) -> &Ident { @@ -38,4 +34,3 @@ impl Function { self.decl().inputs.iter().find(|arg| arg.named(name)) } } -