From e614bbcd301eb4c3dbb65a4aa3147dc0b6ff197c Mon Sep 17 00:00:00 2001 From: yukang Date: Thu, 4 Aug 2022 09:28:59 +0800 Subject: link_ordinal is available for foreign static --- .../ui/rfc-2627-raw-dylib/link-ordinal-not-foreign-fn.rs | 11 +++++++++-- .../ui/rfc-2627-raw-dylib/link-ordinal-not-foreign-fn.stderr | 12 +++++++++--- 2 files changed, 18 insertions(+), 5 deletions(-) (limited to 'src/test/ui') diff --git a/src/test/ui/rfc-2627-raw-dylib/link-ordinal-not-foreign-fn.rs b/src/test/ui/rfc-2627-raw-dylib/link-ordinal-not-foreign-fn.rs index c86756be4f6..5d273d52a92 100644 --- a/src/test/ui/rfc-2627-raw-dylib/link-ordinal-not-foreign-fn.rs +++ b/src/test/ui/rfc-2627-raw-dylib/link-ordinal-not-foreign-fn.rs @@ -2,17 +2,24 @@ //~^ WARN the feature `raw_dylib` is incomplete #[link_ordinal(123)] -//~^ ERROR attribute should be applied to a foreign function +//~^ ERROR attribute should be applied to a foreign function or static struct Foo {} #[link_ordinal(123)] -//~^ ERROR attribute should be applied to a foreign function +//~^ ERROR attribute should be applied to a foreign function or static fn test() {} +#[link_ordinal(42)] +//~^ ERROR attribute should be applied to a foreign function or static +static mut imported_val: i32 = 123; + #[link(name = "exporter", kind = "raw-dylib")] extern { #[link_ordinal(13)] fn imported_function(); + + #[link_ordinal(42)] + static mut imported_variable: i32; } fn main() {} diff --git a/src/test/ui/rfc-2627-raw-dylib/link-ordinal-not-foreign-fn.stderr b/src/test/ui/rfc-2627-raw-dylib/link-ordinal-not-foreign-fn.stderr index c3c399d5759..8fa2f16f44d 100644 --- a/src/test/ui/rfc-2627-raw-dylib/link-ordinal-not-foreign-fn.stderr +++ b/src/test/ui/rfc-2627-raw-dylib/link-ordinal-not-foreign-fn.stderr @@ -7,17 +7,23 @@ LL | #![feature(raw_dylib)] = note: `#[warn(incomplete_features)]` on by default = note: see issue #58713 for more information -error: attribute should be applied to a foreign function +error: attribute should be applied to a foreign function or static --> $DIR/link-ordinal-not-foreign-fn.rs:4:1 | LL | #[link_ordinal(123)] | ^^^^^^^^^^^^^^^^^^^^ -error: attribute should be applied to a foreign function +error: attribute should be applied to a foreign function or static --> $DIR/link-ordinal-not-foreign-fn.rs:8:1 | LL | #[link_ordinal(123)] | ^^^^^^^^^^^^^^^^^^^^ -error: aborting due to 2 previous errors; 1 warning emitted +error: attribute should be applied to a foreign function or static + --> $DIR/link-ordinal-not-foreign-fn.rs:12:1 + | +LL | #[link_ordinal(42)] + | ^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 3 previous errors; 1 warning emitted -- cgit 1.4.1-3-g733a5