1
Fork 0

Libsyntax has been updated

This commit is contained in:
GuillaumeGomez 2015-02-03 23:31:06 +01:00
parent 12f1f4c546
commit 8b12d3ddf9
26 changed files with 93 additions and 121 deletions

View file

@ -10,7 +10,6 @@
use std::cell::RefCell;
use std::collections::BTreeMap;
use std::ops::Deref;
use ast;
use ast::{Ident, Name, TokenTree};
@ -59,7 +58,7 @@ pub fn expand_diagnostic_used<'cx>(ecx: &'cx mut ExtCtxt,
match diagnostics.insert(code.name, span) {
Some(previous_span) => {
ecx.span_warn(span, &format!(
"diagnostic code {} already used", token::get_ident(code).deref()
"diagnostic code {} already used", &token::get_ident(code)[]
)[]);
ecx.span_note(previous_span, "previous invocation");
},
@ -70,7 +69,7 @@ pub fn expand_diagnostic_used<'cx>(ecx: &'cx mut ExtCtxt,
with_registered_diagnostics(|diagnostics| {
if !diagnostics.contains_key(&code.name) {
ecx.span_err(span, &format!(
"used diagnostic code {} not registered", token::get_ident(code).deref()
"used diagnostic code {} not registered", &token::get_ident(code)[]
)[]);
}
});
@ -95,12 +94,12 @@ pub fn expand_register_diagnostic<'cx>(ecx: &'cx mut ExtCtxt,
with_registered_diagnostics(|diagnostics| {
if diagnostics.insert(code.name, description).is_some() {
ecx.span_err(span, &format!(
"diagnostic code {} already registered", token::get_ident(*code).deref()
"diagnostic code {} already registered", &token::get_ident(*code)[]
)[]);
}
});
let sym = Ident::new(token::gensym(&(
"__register_diagnostic_".to_string() + token::get_ident(*code).deref()
"__register_diagnostic_".to_string() + &token::get_ident(*code)[]
)[]));
MacItems::new(vec![quote_item!(ecx, mod $sym {}).unwrap()].into_iter())
}