add a #[rustc_coinductive]
attribute
This commit is contained in:
parent
e9ab7872fd
commit
646e667200
7 changed files with 44 additions and 33 deletions
|
@ -156,6 +156,7 @@ impl CheckAttrVisitor<'_> {
|
|||
| sym::rustc_dirty
|
||||
| sym::rustc_if_this_changed
|
||||
| sym::rustc_then_this_would_need => self.check_rustc_dirty_clean(&attr),
|
||||
sym::rustc_coinductive => self.check_rustc_coinductive(&attr, span, target),
|
||||
sym::cmse_nonsecure_entry => {
|
||||
self.check_cmse_nonsecure_entry(hir_id, attr, span, target)
|
||||
}
|
||||
|
@ -1608,6 +1609,20 @@ impl CheckAttrVisitor<'_> {
|
|||
}
|
||||
}
|
||||
|
||||
/// Checks if the `#[rustc_coinductive]` attribute is applied to a trait.
|
||||
fn check_rustc_coinductive(&self, attr: &Attribute, span: Span, target: Target) -> bool {
|
||||
match target {
|
||||
Target::Trait => true,
|
||||
_ => {
|
||||
self.tcx.sess.emit_err(errors::AttrShouldBeAppliedToTrait {
|
||||
attr_span: attr.span,
|
||||
defn_span: span,
|
||||
});
|
||||
false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Checks if `#[link_section]` is applied to a function or static.
|
||||
fn check_link_section(&self, hir_id: HirId, attr: &Attribute, span: Span, target: Target) {
|
||||
match target {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue