Update codegen for 2018-06-22 nightly.

This commit is contained in:
Sergio Benitez 2018-06-22 23:23:47 -07:00
parent 58adbd72f0
commit 4f15ec28c0
2 changed files with 5 additions and 9 deletions

View File

@ -8,7 +8,7 @@ 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 = "2018-06-12"; const MIN_DATE: &'static str = "2018-06-22";
const MIN_VERSION: &'static str = "1.28.0-nightly"; const MIN_VERSION: &'static str = "1.28.0-nightly";
fn main() { fn main() {

View File

@ -6,7 +6,7 @@ use std::collections::HashMap;
use syntax::ext::base::{Annotatable, ExtCtxt}; use syntax::ext::base::{Annotatable, ExtCtxt};
use syntax::print::pprust::{stmt_to_string}; use syntax::print::pprust::{stmt_to_string};
use syntax::ast::{ItemKind, Expr, MetaItem, Mutability, VariantData, Ident}; use syntax::ast::{ItemKind, Expr, MetaItem, Mutability, VariantData, Ident};
use syntax::ast::{StructField, GenericParam}; use syntax::ast::{StructField, GenericParamKind};
use syntax::codemap::Span; use syntax::codemap::Span;
use syntax::ext::build::AstBuilder; use syntax::ext::build::AstBuilder;
use syntax::ptr::P; use syntax::ptr::P;
@ -26,12 +26,10 @@ fn struct_lifetime(ecx: &mut ExtCtxt, item: &Annotatable, sp: Span) -> Option<St
Annotatable::Item(ref item) => match item.node { Annotatable::Item(ref item) => match item.node {
ItemKind::Struct(_, ref generics) => { ItemKind::Struct(_, ref generics) => {
let mut lifetimes = generics.params.iter() let mut lifetimes = generics.params.iter()
.filter_map(|p| match *p { .filter(|p| p.kind == GenericParamKind::Lifetime)
GenericParam::Lifetime(ref def) => Some(def), .map(|p| p.ident.to_string());
_ => None
});
let lifetime = lifetimes.next().map(|d| d.lifetime.ident.to_string()); let lifetime = lifetimes.next();
if lifetimes.next().is_some() { if lifetimes.next().is_some() {
ecx.span_err(generics.span, "cannot have more than one \ ecx.span_err(generics.span, "cannot have more than one \
lifetime parameter when deriving `FromForm`."); lifetime parameter when deriving `FromForm`.");
@ -329,5 +327,3 @@ fn from_form_substructure(cx: &mut ExtCtxt, trait_span: Span, substr: &Substruct
cx.expr_block(cx.block(trait_span, stmts)) cx.expr_block(cx.block(trait_span, stmts))
} }