Update codegen for 2018-04-03 nightly.

This commit is contained in:
Sergio Benitez 2018-04-03 20:48:38 -07:00
parent 89e64d5ab3
commit 2257a3b6d8
2 changed files with 9 additions and 14 deletions

View File

@ -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();

View File

@ -8,18 +8,14 @@ pub struct Function(Spanned<(Ident, FnDecl)>);
impl Function {
pub fn from(annotated: &Annotatable) -> Result<Function, Span> {
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))
}
}