From 69c953edc968930197e9c71895416b6237028fd0 Mon Sep 17 00:00:00 2001 From: Sergio Benitez Date: Fri, 22 Jun 2018 23:23:47 -0700 Subject: [PATCH] Update codegen for 2018-06-22 nightly (1/2). --- core/codegen/build.rs | 2 +- core/codegen/src/decorators/derive_form.rs | 12 ++++-------- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/core/codegen/build.rs b/core/codegen/build.rs index b12d413a..5d108b0c 100644 --- a/core/codegen/build.rs +++ b/core/codegen/build.rs @@ -8,7 +8,7 @@ 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 = "2018-05-30"; +const MIN_DATE: &'static str = "2018-06-22"; const MIN_VERSION: &'static str = "1.28.0-nightly"; fn main() { diff --git a/core/codegen/src/decorators/derive_form.rs b/core/codegen/src/decorators/derive_form.rs index e8eaa824..39430e37 100644 --- a/core/codegen/src/decorators/derive_form.rs +++ b/core/codegen/src/decorators/derive_form.rs @@ -6,7 +6,7 @@ use std::collections::HashMap; use syntax::ext::base::{Annotatable, ExtCtxt}; use syntax::print::pprust::{stmt_to_string}; 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::ext::build::AstBuilder; use syntax::ptr::P; @@ -26,12 +26,10 @@ fn struct_lifetime(ecx: &mut ExtCtxt, item: &Annotatable, sp: Span) -> Option match item.node { ItemKind::Struct(_, ref generics) => { let mut lifetimes = generics.params.iter() - .filter_map(|p| match *p { - GenericParam::Lifetime(ref def) => Some(def), - _ => None - }); + .filter(|p| p.kind == GenericParamKind::Lifetime) + .map(|p| p.ident.to_string()); - let lifetime = lifetimes.next().map(|d| d.lifetime.ident.to_string()); + let lifetime = lifetimes.next(); if lifetimes.next().is_some() { ecx.span_err(generics.span, "cannot have more than one \ 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)) } - -