link_ordinal is available for foreign static

This commit is contained in:
yukang
2022-08-04 09:28:59 +08:00
parent 4a5e83c939
commit e614bbcd30
4 changed files with 21 additions and 8 deletions

View File

@@ -263,5 +263,5 @@ passes-rustc-lint-opt-ty = `#[rustc_lint_opt_ty]` should be applied to a struct
passes-rustc-lint-opt-deny-field-access = `#[rustc_lint_opt_deny_field_access]` should be applied to a field
.label = not a field
passes-link-ordinal = attribute should be applied to a foreign function
.label = not a foreign function
passes-link-ordinal = attribute should be applied to a foreign function or static
.label = not a foreign function or static

View File

@@ -1864,7 +1864,7 @@ impl CheckAttrVisitor<'_> {
fn check_link_ordinal(&self, attr: &Attribute, _span: Span, target: Target) -> bool {
match target {
Target::ForeignFn => true,
Target::ForeignFn | Target::ForeignStatic => true,
_ => {
self.tcx.sess.emit_err(errors::LinkOrdinal { attr_span: attr.span });
false