原书出处
Write Powerful Rust Macros
05 Hiding information and creating mini-DSLs with function-like macros 验证卫生并拼接方法
in this scope. What went wrong? As
you probably suspect, it’s because of hygiene. As stated, mixed_site has the same hygiene rules as declarative macros. And in declarative macros, local variables are not exposed to the outside world. In the parlance of the documentation: a local variable’s span only exists “at the definition site” of the macro but not at the call site, which is, in our case, the main function. Change the greeting span to call_site, and the application compiles and
runs. Now the span exists at the
原书定位详情
来源:a19c7933-4eda-4176-aebd-30fe7e1ad292
正文位置:extracted/Write Powerful Rust Macros/_epub-src/OEBPS/Text/chapter-5.xhtml#p50
EPUB SHA-256:68c7ed23324b44144895c3bb55f55731454da237867b66ec66ca6404f5b93661