Rollup merge of #131034 - Urgau:cfg-true-false, r=nnethercote
Implement RFC3695 Allow boolean literals as cfg predicates This PR implements https://github.com/rust-lang/rfcs/pull/3695: allow boolean literals as cfg predicates, i.e. `cfg(true)` and `cfg(false)`. r? `@nnethercote` *(or anyone with parser knowledge)* cc `@clubby789`
This commit is contained in:
commit
2ceeeb159d
26 changed files with 284 additions and 58 deletions
|
@ -1,7 +1,7 @@
|
|||
use std::ops::ControlFlow;
|
||||
use std::path::{Path, PathBuf};
|
||||
|
||||
use rustc_ast::{CRATE_NODE_ID, NestedMetaItem};
|
||||
use rustc_ast::CRATE_NODE_ID;
|
||||
use rustc_attr as attr;
|
||||
use rustc_data_structures::fx::FxHashSet;
|
||||
use rustc_middle::query::LocalCrate;
|
||||
|
@ -304,7 +304,12 @@ impl<'tcx> Collector<'tcx> {
|
|||
sess.dcx().emit_err(errors::LinkCfgForm { span: item.span() });
|
||||
continue;
|
||||
};
|
||||
let [NestedMetaItem::MetaItem(link_cfg)] = link_cfg else {
|
||||
let [link_cfg] = link_cfg else {
|
||||
sess.dcx()
|
||||
.emit_err(errors::LinkCfgSinglePredicate { span: item.span() });
|
||||
continue;
|
||||
};
|
||||
let Some(link_cfg) = link_cfg.meta_item_or_bool() else {
|
||||
sess.dcx()
|
||||
.emit_err(errors::LinkCfgSinglePredicate { span: item.span() });
|
||||
continue;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue