Update codegen for 2018-04-03 nightly.

This commit is contained in:
Sergio Benitez 2018-04-03 20:48:38 -07:00
parent 502190a555
commit 0146d31cf1
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}; use version_check::{supports_features, is_min_version, is_min_date};
// Specifies the minimum nightly version needed to compile Rocket's codegen. // Specifies the minimum nightly version needed to compile Rocket's codegen.
const MIN_DATE: &'static str = "2017-12-22"; const MIN_DATE: &'static str = "2018-04-03";
const MIN_VERSION: &'static str = "1.24.0-nightly"; const MIN_VERSION: &'static str = "1.27.0-nightly";
fn main() { fn main() {
let ok_channel = supports_features(); let ok_channel = supports_features();

View File

@ -8,18 +8,14 @@ pub struct Function(Spanned<(Ident, FnDecl)>);
impl Function { impl Function {
pub fn from(annotated: &Annotatable) -> Result<Function, Span> { pub fn from(annotated: &Annotatable) -> Result<Function, Span> {
let inner = match *annotated { if let Annotatable::Item(ref item) = *annotated {
Annotatable::Item(ref item) => match item.node { if let ItemKind::Fn(ref decl, ..) = item.node {
ItemKind::Fn(ref decl, ..) => { let inner = (item.ident, decl.clone().into_inner());
span((item.ident, decl.clone().into_inner()), item.span) return Ok(Function(span(inner, item.span)));
} }
_ => return Err(item.span) }
},
Annotatable::TraitItem(ref item) => return Err(item.span),
Annotatable::ImplItem(ref item) => return Err(item.span),
};
Ok(Function(inner)) Err(annotated.span())
} }
pub fn ident(&self) -> &Ident { pub fn ident(&self) -> &Ident {
@ -38,4 +34,3 @@ impl Function {
self.decl().inputs.iter().find(|arg| arg.named(name)) self.decl().inputs.iter().find(|arg| arg.named(name))
} }
} }