Update codegen for 2017-01-03 nightly.

This commit is contained in:
Sergio Benitez 2017-01-04 11:18:22 -06:00
parent 24805bbf16
commit b202fb9748
5 changed files with 8 additions and 7 deletions

View File

@ -14,7 +14,7 @@ use std::process::Command;
use ansi_term::Colour::{Red, Yellow, Blue, White};
// Specifies the minimum nightly version needed to compile Rocket's codegen.
const MIN_VERSION: &'static str = "2016-12-28";
const MIN_VERSION: &'static str = "2017-01-03";
// Convenience macro for writing to stderr.
macro_rules! printerr {

View File

@ -92,6 +92,7 @@
#![crate_type = "dylib"]
#![feature(quote, concat_idents, plugin_registrar, rustc_private, unicode)]
#![feature(custom_attribute)]
#![feature(i128_type)]
#![allow(unused_attributes)]
#![allow(deprecated)]

View File

@ -48,7 +48,7 @@ impl ErrorParams {
}
fn parse_code(ecx: &ExtCtxt, meta_item: &NestedMetaItem) -> Spanned<u16> {
let code_from_u64 = |n: Spanned<u64>| {
let code_from_u128 = |n: Spanned<u128>| {
if n.node < 400 || n.node > 599 {
ecx.span_err(n.span, "code must be >= 400 and <= 599.");
span(0, n.span)
@ -65,12 +65,12 @@ fn parse_code(ecx: &ExtCtxt, meta_item: &NestedMetaItem) -> Spanned<u16> {
if name != &"code" {
ecx.span_err(sp, "the first key, if any, must be 'code'");
} else if let LitKind::Int(n, _) = lit.node {
return code_from_u64(span(n, lit.span))
return code_from_u128(span(n, lit.span))
} else {
ecx.span_err(lit.span, "`code` value must be an integer")
}
} else if let Some(n) = meta_item.int_lit() {
return code_from_u64(span(n, sp))
return code_from_u128(span(n, sp))
} else {
ecx.struct_span_err(sp, r#"expected `code = int` or an integer literal"#)
.help(r#"you can specify the code directly as an integer,

View File

@ -249,7 +249,7 @@ fn parse_data(ecx: &ExtCtxt, kv: &KVSpanned<LitKind>) -> Ident {
fn parse_rank(ecx: &ExtCtxt, kv: &KVSpanned<LitKind>) -> isize {
if let LitKind::Int(n, _) = *kv.value() {
let max = isize::max_value();
if n <= max as u64 {
if n <= max as u128 {
return n as isize;
} else {
let msg = format!("rank must be less than or equal to {}", max);

View File

@ -4,7 +4,7 @@ use syntax::symbol::Symbol;
pub trait MetaItemExt {
fn name_value(&self) -> Option<(&Symbol, &Lit)>;
fn str_lit(&self) -> Option<&Symbol>;
fn int_lit(&self) -> Option<u64>;
fn int_lit(&self) -> Option<u128>;
}
impl MetaItemExt for NestedMetaItem {
@ -22,7 +22,7 @@ impl MetaItemExt for NestedMetaItem {
})
}
fn int_lit(&self) -> Option<u64> {
fn int_lit(&self) -> Option<u128> {
self.literal().and_then(|lit| match lit.node {
LitKind::Int(n, _) => Some(n),
_ => None,