mirror of https://github.com/rwf2/Rocket.git
Update codegen for 2018-04-03 nightly.
This commit is contained in:
parent
502190a555
commit
0146d31cf1
|
@ -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();
|
||||
|
|
|
@ -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))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue