Closed
Description
I tried to use concat_idents!
to construct the name of a type in a macro. I discovered this wasn't possible, but the error message for it doesn't seem right.
cam@zoo /tmp $ cat m.rs
#![feature(concat_idents)]
#![feature(type_macros)]
pub enum YZ { }
macro_rules! test {
($x:ident, $y:ident) => (
pub struct $x {
pub ptr: *mut concat_idents!($y, Z),
}
)
}
test!(X, Y);
cam@zoo /tmp $ multirust run nightly rustc m.rs
m.rs:7:27: 7:40 error: non-expression macro in expression position: concat_idents
m.rs:7 pub ptr: *mut concat_idents!($y, Z),
^~~~~~~~~~~~~
error: aborting due to previous error
cam@zoo /tmp $ multirust run nightly rustc --version
rustc 1.10.0-nightly (cd6a40017 2016-05-16)
Maybe the "non-expression" and "expression" need to be swapped around?
CC @nrc