summaryrefslogtreecommitdiffstats
path: root/tests/ui/rfc-2627-raw-dylib
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/rfc-2627-raw-dylib')
-rw-r--r--tests/ui/rfc-2627-raw-dylib/import-name-type-invalid-format.rs9
-rw-r--r--tests/ui/rfc-2627-raw-dylib/import-name-type-invalid-format.stderr8
-rw-r--r--tests/ui/rfc-2627-raw-dylib/import-name-type-multiple.rs10
-rw-r--r--tests/ui/rfc-2627-raw-dylib/import-name-type-multiple.stderr8
-rw-r--r--tests/ui/rfc-2627-raw-dylib/import-name-type-unknown-value.rs9
-rw-r--r--tests/ui/rfc-2627-raw-dylib/import-name-type-unknown-value.stderr8
-rw-r--r--tests/ui/rfc-2627-raw-dylib/import-name-type-unsupported-link-kind.rs17
-rw-r--r--tests/ui/rfc-2627-raw-dylib/import-name-type-unsupported-link-kind.stderr14
-rw-r--r--tests/ui/rfc-2627-raw-dylib/import-name-type-x86-only.rs7
-rw-r--r--tests/ui/rfc-2627-raw-dylib/import-name-type-x86-only.stderr8
-rw-r--r--tests/ui/rfc-2627-raw-dylib/link-ordinal-and-name.rs15
-rw-r--r--tests/ui/rfc-2627-raw-dylib/link-ordinal-and-name.stderr14
-rw-r--r--tests/ui/rfc-2627-raw-dylib/link-ordinal-invalid-format.rs13
-rw-r--r--tests/ui/rfc-2627-raw-dylib/link-ordinal-invalid-format.stderr18
-rw-r--r--tests/ui/rfc-2627-raw-dylib/link-ordinal-missing-argument.rs13
-rw-r--r--tests/ui/rfc-2627-raw-dylib/link-ordinal-missing-argument.stderr18
-rw-r--r--tests/ui/rfc-2627-raw-dylib/link-ordinal-multiple.rs14
-rw-r--r--tests/ui/rfc-2627-raw-dylib/link-ordinal-multiple.stderr26
-rw-r--r--tests/ui/rfc-2627-raw-dylib/link-ordinal-not-foreign-fn.rs24
-rw-r--r--tests/ui/rfc-2627-raw-dylib/link-ordinal-not-foreign-fn.stderr20
-rw-r--r--tests/ui/rfc-2627-raw-dylib/link-ordinal-too-large.rs13
-rw-r--r--tests/ui/rfc-2627-raw-dylib/link-ordinal-too-large.stderr18
-rw-r--r--tests/ui/rfc-2627-raw-dylib/link-ordinal-too-many-arguments.rs13
-rw-r--r--tests/ui/rfc-2627-raw-dylib/link-ordinal-too-many-arguments.stderr18
-rw-r--r--tests/ui/rfc-2627-raw-dylib/link-ordinal-unsupported-link-kind.rs17
-rw-r--r--tests/ui/rfc-2627-raw-dylib/link-ordinal-unsupported-link-kind.stderr14
-rw-r--r--tests/ui/rfc-2627-raw-dylib/multiple-declarations.rs19
-rw-r--r--tests/ui/rfc-2627-raw-dylib/multiple-declarations.stderr8
-rw-r--r--tests/ui/rfc-2627-raw-dylib/raw-dylib-windows-only.rs6
-rw-r--r--tests/ui/rfc-2627-raw-dylib/raw-dylib-windows-only.stderr9
-rw-r--r--tests/ui/rfc-2627-raw-dylib/unsupported-abi.rs12
-rw-r--r--tests/ui/rfc-2627-raw-dylib/unsupported-abi.stderr8
32 files changed, 428 insertions, 0 deletions
diff --git a/tests/ui/rfc-2627-raw-dylib/import-name-type-invalid-format.rs b/tests/ui/rfc-2627-raw-dylib/import-name-type-invalid-format.rs
new file mode 100644
index 000000000..22d57f8be
--- /dev/null
+++ b/tests/ui/rfc-2627-raw-dylib/import-name-type-invalid-format.rs
@@ -0,0 +1,9 @@
+// only-windows
+// only-x86
+#![feature(raw_dylib)]
+
+#[link(name = "foo", kind = "raw-dylib", import_name_type = 6)]
+//~^ ERROR import name type must be of the form `import_name_type = "string"`
+extern "C" { }
+
+fn main() {}
diff --git a/tests/ui/rfc-2627-raw-dylib/import-name-type-invalid-format.stderr b/tests/ui/rfc-2627-raw-dylib/import-name-type-invalid-format.stderr
new file mode 100644
index 000000000..0e95fec29
--- /dev/null
+++ b/tests/ui/rfc-2627-raw-dylib/import-name-type-invalid-format.stderr
@@ -0,0 +1,8 @@
+error: import name type must be of the form `import_name_type = "string"`
+ --> $DIR/import-name-type-invalid-format.rs:5:42
+ |
+LL | #[link(name = "foo", kind = "raw-dylib", import_name_type = 6)]
+ | ^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/tests/ui/rfc-2627-raw-dylib/import-name-type-multiple.rs b/tests/ui/rfc-2627-raw-dylib/import-name-type-multiple.rs
new file mode 100644
index 000000000..7ccb0082f
--- /dev/null
+++ b/tests/ui/rfc-2627-raw-dylib/import-name-type-multiple.rs
@@ -0,0 +1,10 @@
+// ignore-tidy-linelength
+// only-windows
+// only-x86
+#![feature(raw_dylib)]
+
+#[link(name = "foo", kind = "raw-dylib", import_name_type = "decorated", import_name_type = "decorated")]
+//~^ ERROR multiple `import_name_type` arguments in a single `#[link]` attribute
+extern "C" { }
+
+fn main() {}
diff --git a/tests/ui/rfc-2627-raw-dylib/import-name-type-multiple.stderr b/tests/ui/rfc-2627-raw-dylib/import-name-type-multiple.stderr
new file mode 100644
index 000000000..7c0e0be91
--- /dev/null
+++ b/tests/ui/rfc-2627-raw-dylib/import-name-type-multiple.stderr
@@ -0,0 +1,8 @@
+error: multiple `import_name_type` arguments in a single `#[link]` attribute
+ --> $DIR/import-name-type-multiple.rs:6:74
+ |
+LL | #[link(name = "foo", kind = "raw-dylib", import_name_type = "decorated", import_name_type = "decorated")]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/tests/ui/rfc-2627-raw-dylib/import-name-type-unknown-value.rs b/tests/ui/rfc-2627-raw-dylib/import-name-type-unknown-value.rs
new file mode 100644
index 000000000..f728a578d
--- /dev/null
+++ b/tests/ui/rfc-2627-raw-dylib/import-name-type-unknown-value.rs
@@ -0,0 +1,9 @@
+// only-windows
+// only-x86
+#![feature(raw_dylib)]
+
+#[link(name = "foo", kind = "raw-dylib", import_name_type = "unknown")]
+//~^ ERROR unknown import name type `unknown`, expected one of: decorated, noprefix, undecorated
+extern "C" { }
+
+fn main() {}
diff --git a/tests/ui/rfc-2627-raw-dylib/import-name-type-unknown-value.stderr b/tests/ui/rfc-2627-raw-dylib/import-name-type-unknown-value.stderr
new file mode 100644
index 000000000..2b299f2fe
--- /dev/null
+++ b/tests/ui/rfc-2627-raw-dylib/import-name-type-unknown-value.stderr
@@ -0,0 +1,8 @@
+error: unknown import name type `unknown`, expected one of: decorated, noprefix, undecorated
+ --> $DIR/import-name-type-unknown-value.rs:5:42
+ |
+LL | #[link(name = "foo", kind = "raw-dylib", import_name_type = "unknown")]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/tests/ui/rfc-2627-raw-dylib/import-name-type-unsupported-link-kind.rs b/tests/ui/rfc-2627-raw-dylib/import-name-type-unsupported-link-kind.rs
new file mode 100644
index 000000000..ae9207864
--- /dev/null
+++ b/tests/ui/rfc-2627-raw-dylib/import-name-type-unsupported-link-kind.rs
@@ -0,0 +1,17 @@
+// only-windows
+// only-x86
+#![feature(raw_dylib)]
+
+#[link(name = "foo", import_name_type = "decorated")]
+//~^ ERROR import name type can only be used with link kind `raw-dylib`
+extern "C" { }
+
+#[link(name = "bar", kind = "static", import_name_type = "decorated")]
+//~^ ERROR import name type can only be used with link kind `raw-dylib`
+extern "C" { }
+
+// Specifying `import_name_type` before `kind` shouldn't raise an error.
+#[link(name = "bar", import_name_type = "decorated", kind = "raw-dylib")]
+extern "C" { }
+
+fn main() {}
diff --git a/tests/ui/rfc-2627-raw-dylib/import-name-type-unsupported-link-kind.stderr b/tests/ui/rfc-2627-raw-dylib/import-name-type-unsupported-link-kind.stderr
new file mode 100644
index 000000000..5898cd875
--- /dev/null
+++ b/tests/ui/rfc-2627-raw-dylib/import-name-type-unsupported-link-kind.stderr
@@ -0,0 +1,14 @@
+error: import name type can only be used with link kind `raw-dylib`
+ --> $DIR/import-name-type-unsupported-link-kind.rs:5:22
+ |
+LL | #[link(name = "foo", import_name_type = "decorated")]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: import name type can only be used with link kind `raw-dylib`
+ --> $DIR/import-name-type-unsupported-link-kind.rs:9:39
+ |
+LL | #[link(name = "bar", kind = "static", import_name_type = "decorated")]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 2 previous errors
+
diff --git a/tests/ui/rfc-2627-raw-dylib/import-name-type-x86-only.rs b/tests/ui/rfc-2627-raw-dylib/import-name-type-x86-only.rs
new file mode 100644
index 000000000..346ea18a8
--- /dev/null
+++ b/tests/ui/rfc-2627-raw-dylib/import-name-type-x86-only.rs
@@ -0,0 +1,7 @@
+// only-windows
+// ignore-x86
+#[link(name = "foo", kind = "raw-dylib", import_name_type = "decorated")]
+//~^ ERROR import name type is only supported on x86
+extern "C" { }
+
+fn main() {}
diff --git a/tests/ui/rfc-2627-raw-dylib/import-name-type-x86-only.stderr b/tests/ui/rfc-2627-raw-dylib/import-name-type-x86-only.stderr
new file mode 100644
index 000000000..b56449299
--- /dev/null
+++ b/tests/ui/rfc-2627-raw-dylib/import-name-type-x86-only.stderr
@@ -0,0 +1,8 @@
+error: import name type is only supported on x86
+ --> $DIR/import-name-type-x86-only.rs:3:42
+ |
+LL | #[link(name = "foo", kind = "raw-dylib", import_name_type = "decorated")]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/tests/ui/rfc-2627-raw-dylib/link-ordinal-and-name.rs b/tests/ui/rfc-2627-raw-dylib/link-ordinal-and-name.rs
new file mode 100644
index 000000000..1a128c87a
--- /dev/null
+++ b/tests/ui/rfc-2627-raw-dylib/link-ordinal-and-name.rs
@@ -0,0 +1,15 @@
+#![cfg_attr(target_arch = "x86", feature(raw_dylib))]
+
+#[link(name="foo")]
+extern "C" {
+ #[link_name="foo"]
+ #[link_ordinal(42)]
+ //~^ ERROR cannot use `#[link_name]` with `#[link_ordinal]`
+ fn foo();
+ #[link_name="foo"]
+ #[link_ordinal(5)]
+ //~^ ERROR cannot use `#[link_name]` with `#[link_ordinal]`
+ static mut imported_variable: i32;
+}
+
+fn main() {}
diff --git a/tests/ui/rfc-2627-raw-dylib/link-ordinal-and-name.stderr b/tests/ui/rfc-2627-raw-dylib/link-ordinal-and-name.stderr
new file mode 100644
index 000000000..481a06d27
--- /dev/null
+++ b/tests/ui/rfc-2627-raw-dylib/link-ordinal-and-name.stderr
@@ -0,0 +1,14 @@
+error: cannot use `#[link_name]` with `#[link_ordinal]`
+ --> $DIR/link-ordinal-and-name.rs:6:5
+ |
+LL | #[link_ordinal(42)]
+ | ^^^^^^^^^^^^^^^^^^^
+
+error: cannot use `#[link_name]` with `#[link_ordinal]`
+ --> $DIR/link-ordinal-and-name.rs:10:5
+ |
+LL | #[link_ordinal(5)]
+ | ^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 2 previous errors
+
diff --git a/tests/ui/rfc-2627-raw-dylib/link-ordinal-invalid-format.rs b/tests/ui/rfc-2627-raw-dylib/link-ordinal-invalid-format.rs
new file mode 100644
index 000000000..7c8da050c
--- /dev/null
+++ b/tests/ui/rfc-2627-raw-dylib/link-ordinal-invalid-format.rs
@@ -0,0 +1,13 @@
+#![cfg_attr(target_arch = "x86", feature(raw_dylib))]
+
+#[link(name = "foo")]
+extern "C" {
+ #[link_ordinal("JustMonika")]
+ //~^ ERROR illegal ordinal format in `link_ordinal`
+ fn foo();
+ #[link_ordinal("JustMonika")]
+ //~^ ERROR illegal ordinal format in `link_ordinal`
+ static mut imported_variable: i32;
+}
+
+fn main() {}
diff --git a/tests/ui/rfc-2627-raw-dylib/link-ordinal-invalid-format.stderr b/tests/ui/rfc-2627-raw-dylib/link-ordinal-invalid-format.stderr
new file mode 100644
index 000000000..55cdcad75
--- /dev/null
+++ b/tests/ui/rfc-2627-raw-dylib/link-ordinal-invalid-format.stderr
@@ -0,0 +1,18 @@
+error: illegal ordinal format in `link_ordinal`
+ --> $DIR/link-ordinal-invalid-format.rs:5:5
+ |
+LL | #[link_ordinal("JustMonika")]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: an unsuffixed integer value, e.g., `1`, is expected
+
+error: illegal ordinal format in `link_ordinal`
+ --> $DIR/link-ordinal-invalid-format.rs:8:5
+ |
+LL | #[link_ordinal("JustMonika")]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: an unsuffixed integer value, e.g., `1`, is expected
+
+error: aborting due to 2 previous errors
+
diff --git a/tests/ui/rfc-2627-raw-dylib/link-ordinal-missing-argument.rs b/tests/ui/rfc-2627-raw-dylib/link-ordinal-missing-argument.rs
new file mode 100644
index 000000000..9feed3941
--- /dev/null
+++ b/tests/ui/rfc-2627-raw-dylib/link-ordinal-missing-argument.rs
@@ -0,0 +1,13 @@
+#![cfg_attr(target_arch = "x86", feature(raw_dylib))]
+
+#[link(name = "foo")]
+extern "C" {
+ #[link_ordinal()]
+ //~^ ERROR incorrect number of arguments to `#[link_ordinal]`
+ fn foo();
+ #[link_ordinal()]
+ //~^ ERROR incorrect number of arguments to `#[link_ordinal]`
+ static mut imported_variable: i32;
+}
+
+fn main() {}
diff --git a/tests/ui/rfc-2627-raw-dylib/link-ordinal-missing-argument.stderr b/tests/ui/rfc-2627-raw-dylib/link-ordinal-missing-argument.stderr
new file mode 100644
index 000000000..853cdad8c
--- /dev/null
+++ b/tests/ui/rfc-2627-raw-dylib/link-ordinal-missing-argument.stderr
@@ -0,0 +1,18 @@
+error: incorrect number of arguments to `#[link_ordinal]`
+ --> $DIR/link-ordinal-missing-argument.rs:5:5
+ |
+LL | #[link_ordinal()]
+ | ^^^^^^^^^^^^^^^^^
+ |
+ = note: the attribute requires exactly one argument
+
+error: incorrect number of arguments to `#[link_ordinal]`
+ --> $DIR/link-ordinal-missing-argument.rs:8:5
+ |
+LL | #[link_ordinal()]
+ | ^^^^^^^^^^^^^^^^^
+ |
+ = note: the attribute requires exactly one argument
+
+error: aborting due to 2 previous errors
+
diff --git a/tests/ui/rfc-2627-raw-dylib/link-ordinal-multiple.rs b/tests/ui/rfc-2627-raw-dylib/link-ordinal-multiple.rs
new file mode 100644
index 000000000..631c363d4
--- /dev/null
+++ b/tests/ui/rfc-2627-raw-dylib/link-ordinal-multiple.rs
@@ -0,0 +1,14 @@
+// only-windows
+#![cfg_attr(target_arch = "x86", feature(raw_dylib))]
+
+#[link(name = "foo", kind = "raw-dylib")]
+extern "C" {
+ #[link_ordinal(1)] //~ ERROR multiple `link_ordinal` attributes
+ #[link_ordinal(2)]
+ fn foo();
+ #[link_ordinal(1)] //~ ERROR multiple `link_ordinal` attributes
+ #[link_ordinal(2)]
+ static mut imported_variable: i32;
+}
+
+fn main() {}
diff --git a/tests/ui/rfc-2627-raw-dylib/link-ordinal-multiple.stderr b/tests/ui/rfc-2627-raw-dylib/link-ordinal-multiple.stderr
new file mode 100644
index 000000000..c0453d2bf
--- /dev/null
+++ b/tests/ui/rfc-2627-raw-dylib/link-ordinal-multiple.stderr
@@ -0,0 +1,26 @@
+error: multiple `link_ordinal` attributes
+ --> $DIR/link-ordinal-multiple.rs:6:5
+ |
+LL | #[link_ordinal(1)]
+ | ^^^^^^^^^^^^^^^^^^ help: remove this attribute
+ |
+note: attribute also specified here
+ --> $DIR/link-ordinal-multiple.rs:7:5
+ |
+LL | #[link_ordinal(2)]
+ | ^^^^^^^^^^^^^^^^^^
+
+error: multiple `link_ordinal` attributes
+ --> $DIR/link-ordinal-multiple.rs:9:5
+ |
+LL | #[link_ordinal(1)]
+ | ^^^^^^^^^^^^^^^^^^ help: remove this attribute
+ |
+note: attribute also specified here
+ --> $DIR/link-ordinal-multiple.rs:10:5
+ |
+LL | #[link_ordinal(2)]
+ | ^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 2 previous errors
+
diff --git a/tests/ui/rfc-2627-raw-dylib/link-ordinal-not-foreign-fn.rs b/tests/ui/rfc-2627-raw-dylib/link-ordinal-not-foreign-fn.rs
new file mode 100644
index 000000000..54e614164
--- /dev/null
+++ b/tests/ui/rfc-2627-raw-dylib/link-ordinal-not-foreign-fn.rs
@@ -0,0 +1,24 @@
+#![cfg_attr(target_arch = "x86", feature(raw_dylib))]
+
+#[link_ordinal(123)]
+//~^ 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 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/tests/ui/rfc-2627-raw-dylib/link-ordinal-not-foreign-fn.stderr b/tests/ui/rfc-2627-raw-dylib/link-ordinal-not-foreign-fn.stderr
new file mode 100644
index 000000000..ec4104fbe
--- /dev/null
+++ b/tests/ui/rfc-2627-raw-dylib/link-ordinal-not-foreign-fn.stderr
@@ -0,0 +1,20 @@
+error: attribute should be applied to a foreign function or static
+ --> $DIR/link-ordinal-not-foreign-fn.rs:3:1
+ |
+LL | #[link_ordinal(123)]
+ | ^^^^^^^^^^^^^^^^^^^^
+
+error: attribute should be applied to a foreign function or static
+ --> $DIR/link-ordinal-not-foreign-fn.rs:7:1
+ |
+LL | #[link_ordinal(123)]
+ | ^^^^^^^^^^^^^^^^^^^^
+
+error: attribute should be applied to a foreign function or static
+ --> $DIR/link-ordinal-not-foreign-fn.rs:11:1
+ |
+LL | #[link_ordinal(42)]
+ | ^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 3 previous errors
+
diff --git a/tests/ui/rfc-2627-raw-dylib/link-ordinal-too-large.rs b/tests/ui/rfc-2627-raw-dylib/link-ordinal-too-large.rs
new file mode 100644
index 000000000..46731581e
--- /dev/null
+++ b/tests/ui/rfc-2627-raw-dylib/link-ordinal-too-large.rs
@@ -0,0 +1,13 @@
+#![cfg_attr(target_arch = "x86", feature(raw_dylib))]
+
+#[link(name = "foo")]
+extern "C" {
+ #[link_ordinal(72436)]
+ //~^ ERROR ordinal value in `link_ordinal` is too large: `72436`
+ fn foo();
+ #[link_ordinal(72436)]
+ //~^ ERROR ordinal value in `link_ordinal` is too large: `72436`
+ static mut imported_variable: i32;
+}
+
+fn main() {}
diff --git a/tests/ui/rfc-2627-raw-dylib/link-ordinal-too-large.stderr b/tests/ui/rfc-2627-raw-dylib/link-ordinal-too-large.stderr
new file mode 100644
index 000000000..fef6de6ae
--- /dev/null
+++ b/tests/ui/rfc-2627-raw-dylib/link-ordinal-too-large.stderr
@@ -0,0 +1,18 @@
+error: ordinal value in `link_ordinal` is too large: `72436`
+ --> $DIR/link-ordinal-too-large.rs:5:5
+ |
+LL | #[link_ordinal(72436)]
+ | ^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: the value may not exceed `u16::MAX`
+
+error: ordinal value in `link_ordinal` is too large: `72436`
+ --> $DIR/link-ordinal-too-large.rs:8:5
+ |
+LL | #[link_ordinal(72436)]
+ | ^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: the value may not exceed `u16::MAX`
+
+error: aborting due to 2 previous errors
+
diff --git a/tests/ui/rfc-2627-raw-dylib/link-ordinal-too-many-arguments.rs b/tests/ui/rfc-2627-raw-dylib/link-ordinal-too-many-arguments.rs
new file mode 100644
index 000000000..71e0ac9f3
--- /dev/null
+++ b/tests/ui/rfc-2627-raw-dylib/link-ordinal-too-many-arguments.rs
@@ -0,0 +1,13 @@
+#![cfg_attr(target_arch = "x86", feature(raw_dylib))]
+
+#[link(name = "foo")]
+extern "C" {
+ #[link_ordinal(3, 4)]
+ //~^ ERROR incorrect number of arguments to `#[link_ordinal]`
+ fn foo();
+ #[link_ordinal(3, 4)]
+ //~^ ERROR incorrect number of arguments to `#[link_ordinal]`
+ static mut imported_variable: i32;
+}
+
+fn main() {}
diff --git a/tests/ui/rfc-2627-raw-dylib/link-ordinal-too-many-arguments.stderr b/tests/ui/rfc-2627-raw-dylib/link-ordinal-too-many-arguments.stderr
new file mode 100644
index 000000000..7e0fcd845
--- /dev/null
+++ b/tests/ui/rfc-2627-raw-dylib/link-ordinal-too-many-arguments.stderr
@@ -0,0 +1,18 @@
+error: incorrect number of arguments to `#[link_ordinal]`
+ --> $DIR/link-ordinal-too-many-arguments.rs:5:5
+ |
+LL | #[link_ordinal(3, 4)]
+ | ^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: the attribute requires exactly one argument
+
+error: incorrect number of arguments to `#[link_ordinal]`
+ --> $DIR/link-ordinal-too-many-arguments.rs:8:5
+ |
+LL | #[link_ordinal(3, 4)]
+ | ^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: the attribute requires exactly one argument
+
+error: aborting due to 2 previous errors
+
diff --git a/tests/ui/rfc-2627-raw-dylib/link-ordinal-unsupported-link-kind.rs b/tests/ui/rfc-2627-raw-dylib/link-ordinal-unsupported-link-kind.rs
new file mode 100644
index 000000000..329c93fc1
--- /dev/null
+++ b/tests/ui/rfc-2627-raw-dylib/link-ordinal-unsupported-link-kind.rs
@@ -0,0 +1,17 @@
+#![cfg_attr(target_arch = "x86", feature(raw_dylib))]
+
+#[link(name = "foo")]
+extern "C" {
+ #[link_ordinal(3)]
+ //~^ ERROR `#[link_ordinal]` is only supported if link kind is `raw-dylib`
+ fn foo();
+}
+
+#[link(name = "bar", kind = "static")]
+extern "C" {
+ #[link_ordinal(3)]
+ //~^ ERROR `#[link_ordinal]` is only supported if link kind is `raw-dylib`
+ fn bar();
+}
+
+fn main() {}
diff --git a/tests/ui/rfc-2627-raw-dylib/link-ordinal-unsupported-link-kind.stderr b/tests/ui/rfc-2627-raw-dylib/link-ordinal-unsupported-link-kind.stderr
new file mode 100644
index 000000000..5fbffbda5
--- /dev/null
+++ b/tests/ui/rfc-2627-raw-dylib/link-ordinal-unsupported-link-kind.stderr
@@ -0,0 +1,14 @@
+error: `#[link_ordinal]` is only supported if link kind is `raw-dylib`
+ --> $DIR/link-ordinal-unsupported-link-kind.rs:5:5
+ |
+LL | #[link_ordinal(3)]
+ | ^^^^^^^^^^^^^^^^^^
+
+error: `#[link_ordinal]` is only supported if link kind is `raw-dylib`
+ --> $DIR/link-ordinal-unsupported-link-kind.rs:12:5
+ |
+LL | #[link_ordinal(3)]
+ | ^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 2 previous errors
+
diff --git a/tests/ui/rfc-2627-raw-dylib/multiple-declarations.rs b/tests/ui/rfc-2627-raw-dylib/multiple-declarations.rs
new file mode 100644
index 000000000..6542faad2
--- /dev/null
+++ b/tests/ui/rfc-2627-raw-dylib/multiple-declarations.rs
@@ -0,0 +1,19 @@
+// only-x86
+// only-windows
+// compile-flags: --crate-type lib --emit link
+#![allow(clashing_extern_declarations)]
+#![feature(raw_dylib)]
+#[link(name = "foo", kind = "raw-dylib")]
+extern "C" {
+ fn f(x: i32);
+}
+
+pub fn lib_main() {
+ #[link(name = "foo", kind = "raw-dylib")]
+ extern "stdcall" {
+ fn f(x: i32);
+ //~^ ERROR multiple declarations of external function `f` from library `foo.dll` have different calling conventions
+ }
+
+ unsafe { f(42); }
+}
diff --git a/tests/ui/rfc-2627-raw-dylib/multiple-declarations.stderr b/tests/ui/rfc-2627-raw-dylib/multiple-declarations.stderr
new file mode 100644
index 000000000..c6808bec7
--- /dev/null
+++ b/tests/ui/rfc-2627-raw-dylib/multiple-declarations.stderr
@@ -0,0 +1,8 @@
+error: multiple declarations of external function `f` from library `foo.dll` have different calling conventions
+ --> $DIR/multiple-declarations.rs:14:9
+ |
+LL | fn f(x: i32);
+ | ^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/tests/ui/rfc-2627-raw-dylib/raw-dylib-windows-only.rs b/tests/ui/rfc-2627-raw-dylib/raw-dylib-windows-only.rs
new file mode 100644
index 000000000..4efffbd53
--- /dev/null
+++ b/tests/ui/rfc-2627-raw-dylib/raw-dylib-windows-only.rs
@@ -0,0 +1,6 @@
+// ignore-windows
+// compile-flags: --crate-type lib
+#![cfg_attr(target_arch = "x86", feature(raw_dylib))]
+#[link(name = "foo", kind = "raw-dylib")]
+//~^ ERROR: link kind `raw-dylib` is only supported on Windows targets
+extern "C" {}
diff --git a/tests/ui/rfc-2627-raw-dylib/raw-dylib-windows-only.stderr b/tests/ui/rfc-2627-raw-dylib/raw-dylib-windows-only.stderr
new file mode 100644
index 000000000..14e791f1f
--- /dev/null
+++ b/tests/ui/rfc-2627-raw-dylib/raw-dylib-windows-only.stderr
@@ -0,0 +1,9 @@
+error[E0455]: link kind `raw-dylib` is only supported on Windows targets
+ --> $DIR/raw-dylib-windows-only.rs:4:29
+ |
+LL | #[link(name = "foo", kind = "raw-dylib")]
+ | ^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0455`.
diff --git a/tests/ui/rfc-2627-raw-dylib/unsupported-abi.rs b/tests/ui/rfc-2627-raw-dylib/unsupported-abi.rs
new file mode 100644
index 000000000..2f5a23e47
--- /dev/null
+++ b/tests/ui/rfc-2627-raw-dylib/unsupported-abi.rs
@@ -0,0 +1,12 @@
+// only-x86_64
+// only-windows
+// compile-flags: --crate-type lib --emit link
+#[link(name = "foo", kind = "raw-dylib")]
+extern "stdcall" {
+ fn f(x: i32);
+ //~^ ERROR ABI not supported by `#[link(kind = "raw-dylib")]` on this architecture
+}
+
+pub fn lib_main() {
+ unsafe { f(42); }
+}
diff --git a/tests/ui/rfc-2627-raw-dylib/unsupported-abi.stderr b/tests/ui/rfc-2627-raw-dylib/unsupported-abi.stderr
new file mode 100644
index 000000000..f8265ae69
--- /dev/null
+++ b/tests/ui/rfc-2627-raw-dylib/unsupported-abi.stderr
@@ -0,0 +1,8 @@
+error: ABI not supported by `#[link(kind = "raw-dylib")]` on this architecture
+ --> $DIR/unsupported-abi.rs:6:5
+ |
+LL | fn f(x: i32);
+ | ^^^^^^^^^^^^^
+
+error: aborting due to previous error
+