diff options
| author | Urgau <urgau@numericable.fr> | 2024-09-30 12:13:17 +0200 |
|---|---|---|
| committer | Urgau <urgau@numericable.fr> | 2024-09-30 12:15:08 +0200 |
| commit | 9cb540a13cb2249754ea3e755cb1472151d061db (patch) | |
| tree | a7553337b4ac13f67cf91165e2dea839a2ead4d6 /compiler | |
| parent | 2da3cb9cab706ff029ee5a40c6dee1c1f188e0bb (diff) | |
Reject leading unsafe in `cfg!(...)` and `--check-cfg`.
Diffstat (limited to 'compiler')
| -rw-r--r-- | compiler/rustc_builtin_macros/src/cfg.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_interface/src/interface.rs | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/compiler/rustc_builtin_macros/src/cfg.rs b/compiler/rustc_builtin_macros/src/cfg.rs index de198115fa0..cf1d5c68ead 100644 --- a/compiler/rustc_builtin_macros/src/cfg.rs +++ b/compiler/rustc_builtin_macros/src/cfg.rs @@ -43,7 +43,7 @@ fn parse_cfg<'a>(cx: &ExtCtxt<'a>, span: Span, tts: TokenStream) -> PResult<'a, return Err(cx.dcx().create_err(errors::RequiresCfgPattern { span })); } - let cfg = p.parse_meta_item(AllowLeadingUnsafe::Yes)?; + let cfg = p.parse_meta_item(AllowLeadingUnsafe::No)?; let _ = p.eat(&token::Comma); diff --git a/compiler/rustc_interface/src/interface.rs b/compiler/rustc_interface/src/interface.rs index c2241773c8c..780693f8932 100644 --- a/compiler/rustc_interface/src/interface.rs +++ b/compiler/rustc_interface/src/interface.rs @@ -174,7 +174,7 @@ pub(crate) fn parse_check_cfg(dcx: DiagCtxtHandle<'_>, specs: Vec<String>) -> Ch } }; - let meta_item = match parser.parse_meta_item(AllowLeadingUnsafe::Yes) { + let meta_item = match parser.parse_meta_item(AllowLeadingUnsafe::No) { Ok(meta_item) if parser.token == token::Eof => meta_item, Ok(..) => expected_error(), Err(err) => { |
