Update codegen for 2018-05-03 nightly.

This commit is contained in:
Tim "S.D.Eagle" Zeitz 2018-05-04 10:19:44 +02:00 committed by Sergio Benitez
parent 47df409be2
commit aeaa4d7883
3 changed files with 6 additions and 6 deletions

View File

@ -62,7 +62,7 @@ fn parse_code(ecx: &ExtCtxt, meta_item: &NestedMetaItem) -> Spanned<u16> {
let sp = meta_item.span();
if let Some((name, lit)) = meta_item.name_value() {
if name != &"code" {
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_u128(span(n, lit.span))

View File

@ -170,7 +170,7 @@ 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.ident.name.as_str()) {
if let Ok(method) = Method::from_str(&word.name().as_str()) {
if is_valid_method(method) {
return span(method, word.span());
}
@ -193,7 +193,7 @@ fn parse_path(ecx: &ExtCtxt,
-> (Spanned<URI<'static>>, Option<Spanned<Ident>>) {
let sp = meta_item.span();
if let Some((name, lit)) = meta_item.name_value() {
if name != &"path" {
if name != "path" {
ecx.span_err(sp, "the first key, if any, must be 'path'");
} else if let LitKind::Str(ref s, _) = lit.node {
return validate_uri(ecx, &s.as_str(), lit.span);

View File

@ -2,15 +2,15 @@ use syntax::ast::{LitKind, NestedMetaItem, MetaItemKind, Lit};
use syntax::symbol::Symbol;
pub trait MetaItemExt {
fn name_value(&self) -> Option<(&Symbol, &Lit)>;
fn name_value(&self) -> Option<(Symbol, &Lit)>;
fn str_lit(&self) -> Option<&Symbol>;
fn int_lit(&self) -> Option<u128>;
}
impl MetaItemExt for NestedMetaItem {
fn name_value(&self) -> Option<(&Symbol, &Lit)> {
fn name_value(&self) -> Option<(Symbol, &Lit)> {
self.meta_item().and_then(|mi| match mi.node {
MetaItemKind::NameValue(ref l) => Some((&mi.ident.name, l)),
MetaItemKind::NameValue(ref l) => Some((mi.name(), l)),
_ => None,
})
}