Update codegen for 2017-12-11 nightly.

This commit is contained in:
Sergio Benitez 2017-12-14 15:09:48 +07:00
parent 4749b541a9
commit 4ea9b046cd
2 changed files with 23 additions and 27 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-11-08"; const MIN_DATE: &'static str = "2017-12-11";
const MIN_VERSION: &'static str = "1.23.0-nightly"; const MIN_VERSION: &'static str = "1.24.0-nightly";
fn main() { fn main() {
let ok_channel = supports_features(); let ok_channel = supports_features();

View File

@ -58,7 +58,8 @@ pub fn from_form_derive(ecx: &mut ExtCtxt, span: Span, meta_item: &MetaItem,
}; };
// The error type in the derived implementation. // 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 { let trait_def = TraitDef {
is_unsafe: false, 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 // match is made with something of that type, and since we always emit
// an `Err` match, we'll get this lint warning. // an `Err` match, we'll get this lint warning.
attributes: vec![quote_attr!(ecx, #[allow(unreachable_code, unreachable_patterns)])], attributes: vec![quote_attr!(ecx, #[allow(unreachable_code, unreachable_patterns)])],
path: ty::Path { path: ty::Path::new_(
path: vec!["rocket", "request", "FromForm"], vec!["rocket", "request", "FromForm"],
lifetime: lifetime_var, lifetime_var,
params: vec![], vec![],
global: true, ty::PathKind::Global,
}, ),
additional_bounds: Vec::new(), additional_bounds: Vec::new(),
generics: trait_generics, generics: trait_generics,
methods: vec![ methods: vec![
@ -84,30 +85,25 @@ pub fn from_form_derive(ecx: &mut ExtCtxt, span: Span, meta_item: &MetaItem,
explicit_self: None, explicit_self: None,
args: vec![ args: vec![
ty::Ptr( ty::Ptr(
Box::new(ty::Literal(ty::Path { Box::new(ty::Literal(ty::Path::new_(
path: vec!["rocket", "request", "FormItems"], vec!["rocket", "request", "FormItems"],
lifetime: lifetime_var, lifetime_var,
params: vec![], vec![],
global: true ty::PathKind::Global,
})), ))),
ty::Borrowed(None, Mutability::Mutable) ty::Borrowed(None, Mutability::Mutable)
), ),
ty::Literal(ty::Path { ty::Literal(ty::Path::new_local("bool")),
path: vec!["bool"],
lifetime: None,
params: vec![],
global: false,
})
], ],
ret_ty: ty::Literal(ty::Path { ret_ty: ty::Literal(ty::Path::new_(
path: vec!["std", "result", "Result"], vec!["result", "Result"],
lifetime: None, None,
params: vec![ vec![
Box::new(ty::Ty::Self_), Box::new(ty::Ty::Self_),
Box::new(error_type.clone()) Box::new(error_type.clone())
], ],
global: true, ty::PathKind::Std,
}), )),
attributes: vec![], attributes: vec![],
is_unsafe: false, is_unsafe: false,
combine_substructure: c_s(Box::new(from_form_substructure)), combine_substructure: c_s(Box::new(from_form_substructure)),