diff options
| author | clubby789 <jamie@hill-daniel.co.uk> | 2025-03-21 05:09:57 +0000 |
|---|---|---|
| committer | clubby789 <jamie@hill-daniel.co.uk> | 2025-04-03 09:54:23 +0000 |
| commit | 3df2acd31ba14544ddb7fb1b0e73e6235824d4a3 (patch) | |
| tree | c6e26e1eb7ce2a3612e717762272beaa612fc893 /compiler/rustc_interface/src/interface.rs | |
| parent | 78948ac259253ce89effca1e8bb64d16f4684aa4 (diff) | |
| download | rust-3df2acd31ba14544ddb7fb1b0e73e6235824d4a3.tar.gz rust-3df2acd31ba14544ddb7fb1b0e73e6235824d4a3.zip | |
Allow boolean literals in `check-cfg`
Diffstat (limited to 'compiler/rustc_interface/src/interface.rs')
| -rw-r--r-- | compiler/rustc_interface/src/interface.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/compiler/rustc_interface/src/interface.rs b/compiler/rustc_interface/src/interface.rs index 3f87b1a547b..33b4a48b28d 100644 --- a/compiler/rustc_interface/src/interface.rs +++ b/compiler/rustc_interface/src/interface.rs @@ -204,6 +204,14 @@ pub(crate) fn parse_check_cfg(dcx: DiagCtxtHandle<'_>, specs: Vec<String>) -> Ch error!("`cfg()` names cannot be after values"); } names.push(ident); + } else if let Some(boolean) = arg.boolean_literal() { + if values_specified { + error!("`cfg()` names cannot be after values"); + } + names.push(rustc_span::Ident::new( + if boolean { rustc_span::kw::True } else { rustc_span::kw::False }, + arg.span(), + )); } else if arg.has_name(sym::any) && let Some(args) = arg.meta_item_list() { |
