From 4ea9b046cd8cd1f204f7faeb80128a8321c6c461 Mon Sep 17 00:00:00 2001 From: Sergio Benitez Date: Thu, 14 Dec 2017 15:09:48 +0700 Subject: [PATCH] Update codegen for 2017-12-11 nightly. --- codegen/build.rs | 4 +-- codegen/src/decorators/derive_form.rs | 46 ++++++++++++--------------- 2 files changed, 23 insertions(+), 27 deletions(-) diff --git a/codegen/build.rs b/codegen/build.rs index 3ac078ca..ae12416b 100644 --- a/codegen/build.rs +++ b/codegen/build.rs @@ -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-11-08"; -const MIN_VERSION: &'static str = "1.23.0-nightly"; +const MIN_DATE: &'static str = "2017-12-11"; +const MIN_VERSION: &'static str = "1.24.0-nightly"; fn main() { let ok_channel = supports_features(); diff --git a/codegen/src/decorators/derive_form.rs b/codegen/src/decorators/derive_form.rs index 5c986d0c..5eb4f022 100644 --- a/codegen/src/decorators/derive_form.rs +++ b/codegen/src/decorators/derive_form.rs @@ -58,7 +58,8 @@ pub fn from_form_derive(ecx: &mut ExtCtxt, span: Span, meta_item: &MetaItem, }; // The error type in the derived implementation. - let error_type = ty::Ty::Literal(ty::Path::new(vec!["rocket", "Error"])); + let error_type = ty::Ty::Literal(ty::Path::new_(vec!["rocket", "Error"], + None, vec![], ty::PathKind::Global)); let trait_def = TraitDef { is_unsafe: false, @@ -69,12 +70,12 @@ pub fn from_form_derive(ecx: &mut ExtCtxt, span: Span, meta_item: &MetaItem, // match is made with something of that type, and since we always emit // an `Err` match, we'll get this lint warning. attributes: vec![quote_attr!(ecx, #[allow(unreachable_code, unreachable_patterns)])], - path: ty::Path { - path: vec!["rocket", "request", "FromForm"], - lifetime: lifetime_var, - params: vec![], - global: true, - }, + path: ty::Path::new_( + vec!["rocket", "request", "FromForm"], + lifetime_var, + vec![], + ty::PathKind::Global, + ), additional_bounds: Vec::new(), generics: trait_generics, methods: vec![ @@ -84,30 +85,25 @@ pub fn from_form_derive(ecx: &mut ExtCtxt, span: Span, meta_item: &MetaItem, explicit_self: None, args: vec![ ty::Ptr( - Box::new(ty::Literal(ty::Path { - path: vec!["rocket", "request", "FormItems"], - lifetime: lifetime_var, - params: vec![], - global: true - })), + Box::new(ty::Literal(ty::Path::new_( + vec!["rocket", "request", "FormItems"], + lifetime_var, + vec![], + ty::PathKind::Global, + ))), ty::Borrowed(None, Mutability::Mutable) ), - ty::Literal(ty::Path { - path: vec!["bool"], - lifetime: None, - params: vec![], - global: false, - }) + ty::Literal(ty::Path::new_local("bool")), ], - ret_ty: ty::Literal(ty::Path { - path: vec!["std", "result", "Result"], - lifetime: None, - params: vec![ + ret_ty: ty::Literal(ty::Path::new_( + vec!["result", "Result"], + None, + vec![ Box::new(ty::Ty::Self_), Box::new(error_type.clone()) ], - global: true, - }), + ty::PathKind::Std, + )), attributes: vec![], is_unsafe: false, combine_substructure: c_s(Box::new(from_form_substructure)),