1
Fork 0

Rollup merge of #131057 - Urgau:cfg-erronous-unsafe, r=jieyouxu

Reject leading unsafe in `cfg!(...)` and `--check-cfg`

This PR reject leading unsafe in `cfg!(...)` and `--check-cfg`.

Fixes (after-backport) https://github.com/rust-lang/rust/issues/131055
r? `@jieyouxu`
This commit is contained in:
Matthias Krüger 2024-09-30 14:33:46 +02:00 committed by GitHub
commit 90fdb11f51
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 33 additions and 5 deletions

View file

@ -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) => {