diff options
| author | Urgau <urgau@numericable.fr> | 2024-10-16 09:41:49 +0200 |
|---|---|---|
| committer | Urgau <urgau@numericable.fr> | 2024-10-16 09:41:49 +0200 |
| commit | 5eb863698964b026149f4ed9f958639eb290f5b3 (patch) | |
| tree | 7ed25a164f9c589ca2a60ac0274a5239ad8dabc4 /compiler/rustc_attr/src | |
| parent | f6648f252a05a0a46c865d7ec836b46290613bf9 (diff) | |
| download | rust-5eb863698964b026149f4ed9f958639eb290f5b3.tar.gz rust-5eb863698964b026149f4ed9f958639eb290f5b3.zip | |
Handle gracefully true/false in `cfg(target(..))` compact
Diffstat (limited to 'compiler/rustc_attr/src')
| -rw-r--r-- | compiler/rustc_attr/src/builtin.rs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/compiler/rustc_attr/src/builtin.rs b/compiler/rustc_attr/src/builtin.rs index c1db4d07dfc..bbb17497684 100644 --- a/compiler/rustc_attr/src/builtin.rs +++ b/compiler/rustc_attr/src/builtin.rs @@ -723,7 +723,13 @@ pub fn eval_condition( } mis.iter().fold(true, |res, mi| { - let mut mi = mi.meta_item().unwrap().clone(); + let Some(mut mi) = mi.meta_item().cloned() else { + dcx.emit_err(session_diagnostics::CfgPredicateIdentifier { + span: mi.span(), + }); + return false; + }; + if let [seg, ..] = &mut mi.path.segments[..] { seg.ident.name = Symbol::intern(&format!("target_{}", seg.ident.name)); } |
