use slicing sugar
This commit is contained in:
parent
6e2bfe4ae8
commit
517f1cc63c
198 changed files with 2383 additions and 2405 deletions
|
@ -56,9 +56,9 @@ pub fn expand_diagnostic_used<'cx>(ecx: &'cx mut ExtCtxt,
|
|||
with_used_diagnostics(|diagnostics| {
|
||||
match diagnostics.insert(code.name, span) {
|
||||
Some(previous_span) => {
|
||||
ecx.span_warn(span, format!(
|
||||
ecx.span_warn(span, &format!(
|
||||
"diagnostic code {} already used", token::get_ident(code).get()
|
||||
).index(&FullRange));
|
||||
)[]);
|
||||
ecx.span_note(previous_span, "previous invocation");
|
||||
},
|
||||
None => ()
|
||||
|
@ -85,14 +85,14 @@ 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!(
|
||||
ecx.span_err(span, &format!(
|
||||
"diagnostic code {} already registered", token::get_ident(*code).get()
|
||||
).index(&FullRange));
|
||||
)[]);
|
||||
}
|
||||
});
|
||||
let sym = Ident::new(token::gensym((
|
||||
let sym = Ident::new(token::gensym(&(
|
||||
"__register_diagnostic_".to_string() + token::get_ident(*code).get()
|
||||
).index(&FullRange)));
|
||||
)[]));
|
||||
MacItems::new(vec![quote_item!(ecx, mod $sym {}).unwrap()].into_iter())
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue