-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Closed
Labels
A-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)A-stabilityArea: `#[stable]`, `#[unstable]` etc.Area: `#[stable]`, `#[unstable]` etc.F-extended_key_value_attributes`#![feature(extended_key_value_attributes)]`#![feature(extended_key_value_attributes)]T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
I tried this code:
#![cfg_attr(
any(),
feature(extended_key_value_attributes),
doc = include_str!("../README.md")
)]
I expected to see this happen: The compiler gives no error, because doc = include_str!
should only be compiled if the predicate is true.
Instead, this happened: The compiler gives an error that extended_key_value_attributes
is unstable.
I guess this happens because the compiler has to parse the attribute even if the cfg is false? @petrochenkov is giving an error here intentional?
Meta
rustc --version
: 1.52.0-nightly (2021-03-01 4f20caa)
cc #78835
Originally posted by @daxpedda in #82539 (comment)
daxpedda, cgranade and TehPers
Metadata
Metadata
Assignees
Labels
A-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)A-stabilityArea: `#[stable]`, `#[unstable]` etc.Area: `#[stable]`, `#[unstable]` etc.F-extended_key_value_attributes`#![feature(extended_key_value_attributes)]`#![feature(extended_key_value_attributes)]T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.