Update codegen for 2018-05-30 nightly.

This commit is contained in:
Sergio Benitez 2018-05-31 20:20:25 +02:00
parent 4376baef91
commit f4be2a69d0
2 changed files with 11 additions and 16 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 = "2018-05-04"; const MIN_DATE: &'static str = "2018-05-30";
const MIN_VERSION: &'static str = "1.27.0-nightly"; const MIN_VERSION: &'static str = "1.28.0-nightly";
fn main() { fn main() {
let ok_channel = supports_features(); let ok_channel = supports_features();

View File

@ -17,15 +17,15 @@ use std::convert::AsRef;
use syntax; use syntax;
use syntax::parse::token::Token; use syntax::parse::token::Token;
use syntax::tokenstream::TokenTree; use syntax::tokenstream::TokenTree;
use syntax::ast::{Item, Ident, Expr}; use syntax::ast::{Item, Expr, Attribute, Ty};
use syntax::ext::base::{Annotatable, ExtCtxt}; use syntax::ext::base::{Annotatable, ExtCtxt};
use syntax::codemap::{Span, Spanned, DUMMY_SP}; use syntax::codemap::{Span, Spanned, DUMMY_SP};
use syntax::ext::quote::rt::ToTokens; use syntax::ext::quote::rt::ToTokens;
use syntax::print::pprust::item_to_string; use syntax::print::pprust::item_to_string;
use syntax::ptr::P; use syntax::symbol::{Ident, Symbol};
use syntax::fold::Folder; use syntax::fold::Folder;
use syntax::ast::{Attribute, Lifetime, LifetimeDef, Ty};
use syntax::attr::HasAttrs; use syntax::attr::HasAttrs;
use syntax::ptr::P;
pub fn span<T>(t: T, span: Span) -> Spanned<T> { pub fn span<T>(t: T, span: Span) -> Spanned<T> {
Spanned { node: t, span: span } Spanned { node: t, span: span }
@ -83,18 +83,13 @@ pub fn parse_as_tokens(ecx: &ExtCtxt, s: &str) -> Vec<TokenTree> {
pub struct TyLifetimeRemover; pub struct TyLifetimeRemover;
// FIXME: Doesn't work for T + whatever.
impl Folder for TyLifetimeRemover { impl Folder for TyLifetimeRemover {
fn fold_opt_lifetime(&mut self, _: Option<Lifetime>) -> Option<Lifetime> { fn fold_ident(&mut self, ident: Ident) -> Ident {
None if ident.as_str().starts_with('\'') {
Ident::new(Symbol::intern("'_"), ident.span)
} else {
ident
} }
fn fold_lifetime_defs(&mut self, _: Vec<LifetimeDef>) -> Vec<LifetimeDef> {
vec![]
}
fn fold_lifetimes(&mut self, _: Vec<Lifetime>) -> Vec<Lifetime> {
vec![]
} }
} }