当我试图在代码中定义宏时,编译器会这样说:
refix/mod.rs:12:1: 12:12 error: macro definitions are not stable enough for use and are subject to change
refix/mod.rs:12 macro_rules! re_fix(
^~~~~~~~~~~
refix/mod.rs:12:1: 12:12 note: add #[feature(macro_rules)] to the crate attributes to enable
refix/mod.rs:12 macro_rules! re_fix(我添加了很多#[feature(macro_rules)],但没有帮助。
源代码:https://gist.github.com/suhr/11207656
是的,他们可能还有很多其他的错误,但是我对这个很感兴趣。
发布于 2014-04-23 09:37:41
我认为这个错误信息有点误导人。您必须将#![feature(macro_rules)]添加到主机箱模块(请注意感叹号),以及#![crate_id=...]和其他模块。
#![crate_id="rsfix#0.0"]
#![feature(macro_rules)]
macro_rules! example( ... )
fn main() {
example!(...);
}这应该适用于最新的编译器版本。
https://stackoverflow.com/questions/23239750
复制相似问题