Closed
Description
Given this procedural macro:
#![crate_type = "proc-macro"]
#![feature(proc_macro)]
extern crate proc_macro;
use proc_macro::*;
#[proc_macro]
pub fn bar(_input: TokenStream) -> TokenStream {
let mut ret = Vec::<TokenTree>::new();
ret.push(Ident::new("static", Span::call_site()).into());
ret.push(Ident::new("FOO", Span::call_site()).into());
ret.push(Punct::new(':', Spacing::Alone).into());
ret.push(Punct::new('&', Spacing::Alone).into());
ret.push(Punct::new('\'', Spacing::Joint).into());
ret.push(Ident::new("static", Span::call_site()).into());
ret.push(Ident::new("i32", Span::call_site()).into());
ret.push(Punct::new('=', Spacing::Alone).into());
ret.push(Punct::new('&', Spacing::Alone).into());
ret.push(Literal::i32_unsuffixed(1).into());
ret.push(Punct::new(';', Spacing::Alone).into());
return ret.into_iter().collect()
}
and this invocation:
#![crate_type = "rlib"]
#![feature(proc_macro)]
extern crate bar;
bar::bar!();
we get:
$ rustc +nightly bar.rs
$ rustc +nightly foo.rs -L .
error: lifetimes cannot use keyword names
--> foo.rs:6:1
|
6 | bar::bar!();
| ^^^^^^^^^^^^
error[E0261]: use of undeclared lifetime name `static`
--> foo.rs:6:1
|
6 | bar::bar!();
| ^^^^^^^^^^^^ undeclared lifetime
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0261`.