Use attribute parser for #[inline()] attribute check - #162683
Conversation
|
Some changes occurred in compiler/rustc_passes/src/check_attr.rs cc @jdonszelmann, @JonathanBrouwer Some changes occurred in compiler/rustc_attr_parsing |
| match kind { | ||
| AttributeKind::NoMangle(..) | ||
| | AttributeKind::ExportName { .. } | ||
| | AttributeKind::RustcStdInternalSymbol | ||
| | AttributeKind::RustcEiiForeignItem | ||
| | AttributeKind::EiiImpl(..) | ||
| | AttributeKind::RustcOffloadKernel => true, | ||
| AttributeKind::Linkage(linkage, _) => *linkage != rustc_attr_ir::Linkage::Internal, | ||
| AttributeKind::Lang(item) => item.link_name().is_some(), | ||
| _ => false, | ||
| } |
There was a problem hiding this comment.
This should be implemented more rigorously, can you refactor this match into a method on AttributeKind and match exhaustively there, similar to encode_cross_crate?
(and then update its and contains_extern_indicator's doc comments to link to each other, because these must be kept in sync)
| } | ||
| scope 18 (inlined <Enumerate<std::slice::Iter<'_, T>> as Iterator>::next) { | ||
| let mut _22: std::option::Option<std::convert::Infallible>; | ||
| let mut _22: std::option::Option<!>; |
There was a problem hiding this comment.
Why does this PR update these tests? 🤔
There was a problem hiding this comment.
Updated by x test --bless, not sure why?
|
Reminder, once the PR becomes ready for a review, use |
|
Some changes occurred in compiler/rustc_attr_ir |
| LinkName { .. } => false, | ||
| LinkOrdinal { .. } => false, | ||
| LinkSection { .. } => false, | ||
| Linkage(linkage, _) => *linkage != crate::Linkage::Internal, |
There was a problem hiding this comment.
Can you also exhaustively match on Linkage here? The idea is that this should refuse to compile if anyone ever adds a new Linkage variant without updating this.
|
Otherwise it looks good, will wait for @JonathanBrouwer for a final review |
|
The job Click to see the possible cause of the failure (guessed by this bot) |
Updates #153101
r? @JonathanBrouwer