You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Macro-expanded unconfigured items are gated feature checked #32840
Macro-expanded unconfigured items are gated feature checked, but ordinary unconfigured items are not. For example, the following should compile, ...
#![cfg_attr(attr, feature(rustc_attrs))]macro_rules! mac {{} => {
#[cfg(attr)]mod m {
#[rustc_error]// ... but if not(attr), this complains about the lack of the rustc_attrs featurefn f(){}}}}mac!{}
If we manually expand mac! {}, it always compiles:
#![cfg_attr(attr, feature(rustc_attrs))]#[cfg(attr)]mod m {#[rustc_error]fnf(){}}
There are arguments on #32648 about why this is not a good idea: #[cfg] is typically used by crates that need to build against both stable and nightly and use nightly-specific features when available (the most important example that I have in mind is syntax extensions using plugins on nightly and syntex on stable). Checking for use of gated features inside this #[cfg]-guarded code will break those crates, and it's not a good thing, this use case is actually useful. This check pass should be removed.
Activity
jseyfried commentedon Apr 8, 2016
It looks like this was intentional (introduced in #22899), but I don't think it's a good idea.
cc @nrc
cc #22250
LeoTestard commentedon Apr 9, 2016
There are arguments on #32648 about why this is not a good idea:
#[cfg]is typically used by crates that need to build against both stable and nightly and use nightly-specific features when available (the most important example that I have in mind is syntax extensions using plugins on nightly and syntex on stable). Checking for use of gated features inside this#[cfg]-guarded code will break those crates, and it's not a good thing, this use case is actually useful. This check pass should be removed.nrc commentedon Apr 12, 2016
cc @rust-lang/lang