简体   繁体   English

rustc中如何处理cfg?

[英]How cfg are dealt with in rustc?

This is a further question on How to extract nightly features used in a crate?这是关于如何提取板条箱中使用的夜间特征的进一步问题? . .

I also want to know where and how #,[cfg_attr(target_os = "macos". feature(...))] is turned into #.[feature(...) .我还想知道#,[cfg_attr(target_os = "macos". feature(...))]在哪里以及如何变成#.[feature(...)

Could someone give me some tips about the process of rustc dealing with cfg.有人可以给我一些关于 rustc 处理 cfg 的过程的提示。

The rustc_expand crate is responsible for expanding macros. rustc_expand crate 负责扩展宏。 It special cases #[cfg] and #[cfg_attr] when parsing attribute macros such that they aren't treated like normal macros.在解析属性宏时, 特殊情况#[cfg]#[cfg_attr]不会像普通宏一样对待。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM