Fix that cfg attribute was incorrectly not a parsed attribute

This commit is contained in:
Jonathan Brouwer 2026-01-11 12:12:41 +01:00
parent 9bc8b40bc3
commit 6153fa0f88
No known key found for this signature in database
GPG key ID: 13619B051B673C52
2 changed files with 11 additions and 3 deletions

View file

@ -442,7 +442,17 @@ impl<'sess, S: Stage> AttributeParser<'sess, S> {
/// Returns whether there is a parser for an attribute with this name
pub fn is_parsed_attribute(path: &[Symbol]) -> bool {
Late::parsers().accepters.contains_key(path) || EARLY_PARSED_ATTRIBUTES.contains(&path)
/// The list of attributes that are parsed attributes,
/// even though they don't have a parser in `Late::parsers()`
const SPECIAL_ATTRIBUTES: &[&[Symbol]] = &[
// Cfg attrs are removed after being early-parsed, so don't need to be in the parser list
&[sym::cfg],
&[sym::cfg_attr],
];
Late::parsers().accepters.contains_key(path)
|| EARLY_PARSED_ATTRIBUTES.contains(&path)
|| SPECIAL_ATTRIBUTES.contains(&path)
}
fn lower_attr_args(&self, args: &ast::AttrArgs, lower_span: impl Fn(Span) -> Span) -> AttrArgs {

View file

@ -338,8 +338,6 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
| sym::warn
| sym::deny
| sym::forbid
| sym::cfg
| sym::cfg_attr
// need to be fixed
| sym::patchable_function_entry // FIXME(patchable_function_entry)
| sym::deprecated_safe // FIXME(deprecated_safe)