mirror of https://github.com/rwf2/Rocket.git
Update codegen for 2018-04-06 nightly.
This commit is contained in:
parent
56e24bd57f
commit
53061f2a65
|
@ -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-04-03";
|
||||
const MIN_DATE: &'static str = "2018-04-06";
|
||||
const MIN_VERSION: &'static str = "1.27.0-nightly";
|
||||
|
||||
fn main() {
|
||||
|
|
|
@ -8,12 +8,11 @@ use syntax::ext::base::{DummyResult, ExtCtxt, MacResult, MacEager};
|
|||
use syntax::parse::token::Token;
|
||||
use syntax::ptr::P;
|
||||
|
||||
#[inline]
|
||||
pub fn prefix_paths(prefix: &str, paths: &mut Vec<Path>) {
|
||||
for p in paths {
|
||||
let last = p.segments.len() - 1;
|
||||
let last_seg = &mut p.segments[last];
|
||||
last_seg.identifier = last_seg.identifier.prepend(prefix);
|
||||
last_seg.ident = last_seg.ident.prepend(prefix);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -170,12 +170,12 @@ pub fn param_to_ident(ecx: &ExtCtxt, s: Spanned<&str>) -> Option<Spanned<Ident>>
|
|||
|
||||
fn parse_method(ecx: &ExtCtxt, meta_item: &NestedMetaItem) -> Spanned<Method> {
|
||||
if let Some(word) = meta_item.word() {
|
||||
if let Ok(method) = Method::from_str(&word.name().as_str()) {
|
||||
if let Ok(method) = Method::from_str(&word.ident.name.as_str()) {
|
||||
if is_valid_method(method) {
|
||||
return span(method, word.span());
|
||||
}
|
||||
} else {
|
||||
let msg = format!("'{}' is not a valid HTTP method.", word.name());
|
||||
let msg = format!("'{}' is not a valid HTTP method.", word.ident);
|
||||
ecx.span_err(word.span(), &msg);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ pub trait ArgExt {
|
|||
impl ArgExt for Arg {
|
||||
fn ident(&self) -> Option<&Ident> {
|
||||
match self.pat.node {
|
||||
PatKind::Ident(_, ref ident, _) => Some(&ident.node),
|
||||
PatKind::Ident(_, ref ident, _) => Some(&ident),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
use std::fmt::Display;
|
||||
use syntax::ast::Ident;
|
||||
use syntax::symbol::Symbol;
|
||||
|
||||
pub trait IdentExt {
|
||||
fn prepend<T: Display>(&self, other: T) -> Ident;
|
||||
|
@ -9,11 +10,11 @@ pub trait IdentExt {
|
|||
impl IdentExt for Ident {
|
||||
fn prepend<T: Display>(&self, other: T) -> Ident {
|
||||
let new_ident = format!("{}{}", other, self.name);
|
||||
Ident::from_str(new_ident.as_str())
|
||||
Ident::new(Symbol::intern(&new_ident), self.span)
|
||||
}
|
||||
|
||||
fn append<T: Display>(&self, other: T) -> Ident {
|
||||
let new_ident = format!("{}{}", self.name, other);
|
||||
Ident::from_str(new_ident.as_str())
|
||||
Ident::new(Symbol::intern(&new_ident), self.span)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ pub trait MetaItemExt {
|
|||
impl MetaItemExt for NestedMetaItem {
|
||||
fn name_value(&self) -> Option<(&Symbol, &Lit)> {
|
||||
self.meta_item().and_then(|mi| match mi.node {
|
||||
MetaItemKind::NameValue(ref l) => Some((&mi.name, l)),
|
||||
MetaItemKind::NameValue(ref l) => Some((&mi.ident.name, l)),
|
||||
_ => None,
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue