From dc0db358abe19481e475e10c32149b53370f1a1c Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Thu, 30 May 2024 05:57:31 +0200 Subject: Merging upstream version 1.72.1+dfsg1. Signed-off-by: Daniel Baumann --- .../rfc-1717-dllimport/1717-dllimport/library-override.rs | 14 ++++++++++++++ tests/ui/rfcs/rfc-1717-dllimport/missing-link-attr.rs | 4 ++++ tests/ui/rfcs/rfc-1717-dllimport/missing-link-attr.stderr | 4 ++++ tests/ui/rfcs/rfc-1717-dllimport/multiple-renames.rs | 7 +++++++ tests/ui/rfcs/rfc-1717-dllimport/multiple-renames.stderr | 4 ++++ tests/ui/rfcs/rfc-1717-dllimport/rename-modifiers.rs | 9 +++++++++ tests/ui/rfcs/rfc-1717-dllimport/rename-modifiers.stderr | 8 ++++++++ tests/ui/rfcs/rfc-1717-dllimport/rename-to-empty.rs | 7 +++++++ tests/ui/rfcs/rfc-1717-dllimport/rename-to-empty.stderr | 4 ++++ 9 files changed, 61 insertions(+) create mode 100644 tests/ui/rfcs/rfc-1717-dllimport/1717-dllimport/library-override.rs create mode 100644 tests/ui/rfcs/rfc-1717-dllimport/missing-link-attr.rs create mode 100644 tests/ui/rfcs/rfc-1717-dllimport/missing-link-attr.stderr create mode 100644 tests/ui/rfcs/rfc-1717-dllimport/multiple-renames.rs create mode 100644 tests/ui/rfcs/rfc-1717-dllimport/multiple-renames.stderr create mode 100644 tests/ui/rfcs/rfc-1717-dllimport/rename-modifiers.rs create mode 100644 tests/ui/rfcs/rfc-1717-dllimport/rename-modifiers.stderr create mode 100644 tests/ui/rfcs/rfc-1717-dllimport/rename-to-empty.rs create mode 100644 tests/ui/rfcs/rfc-1717-dllimport/rename-to-empty.stderr (limited to 'tests/ui/rfcs/rfc-1717-dllimport') diff --git a/tests/ui/rfcs/rfc-1717-dllimport/1717-dllimport/library-override.rs b/tests/ui/rfcs/rfc-1717-dllimport/1717-dllimport/library-override.rs new file mode 100644 index 000000000..014ccac31 --- /dev/null +++ b/tests/ui/rfcs/rfc-1717-dllimport/1717-dllimport/library-override.rs @@ -0,0 +1,14 @@ +// run-pass +// ignore-wasm32-bare no libc to test ffi with +// compile-flags: -lstatic=wronglibrary:rust_test_helpers + +#[link(name = "wronglibrary", kind = "dylib")] +extern "C" { + pub fn rust_dbg_extern_identity_u32(x: u32) -> u32; +} + +fn main() { + unsafe { + rust_dbg_extern_identity_u32(42); + } +} diff --git a/tests/ui/rfcs/rfc-1717-dllimport/missing-link-attr.rs b/tests/ui/rfcs/rfc-1717-dllimport/missing-link-attr.rs new file mode 100644 index 000000000..b46d85160 --- /dev/null +++ b/tests/ui/rfcs/rfc-1717-dllimport/missing-link-attr.rs @@ -0,0 +1,4 @@ +// compile-flags: -l foo:bar +// error-pattern: renaming of the library `foo` was specified + +#![crate_type = "lib"] diff --git a/tests/ui/rfcs/rfc-1717-dllimport/missing-link-attr.stderr b/tests/ui/rfcs/rfc-1717-dllimport/missing-link-attr.stderr new file mode 100644 index 000000000..d4410e147 --- /dev/null +++ b/tests/ui/rfcs/rfc-1717-dllimport/missing-link-attr.stderr @@ -0,0 +1,4 @@ +error: renaming of the library `foo` was specified, however this crate contains no `#[link(...)]` attributes referencing this library + +error: aborting due to previous error + diff --git a/tests/ui/rfcs/rfc-1717-dllimport/multiple-renames.rs b/tests/ui/rfcs/rfc-1717-dllimport/multiple-renames.rs new file mode 100644 index 000000000..106f196b4 --- /dev/null +++ b/tests/ui/rfcs/rfc-1717-dllimport/multiple-renames.rs @@ -0,0 +1,7 @@ +// compile-flags: -l foo:bar -l foo:baz +// error-pattern: multiple renamings were specified for library + +#![crate_type = "lib"] + +#[link(name = "foo")] +extern "C" {} diff --git a/tests/ui/rfcs/rfc-1717-dllimport/multiple-renames.stderr b/tests/ui/rfcs/rfc-1717-dllimport/multiple-renames.stderr new file mode 100644 index 000000000..a6fec9c4e --- /dev/null +++ b/tests/ui/rfcs/rfc-1717-dllimport/multiple-renames.stderr @@ -0,0 +1,4 @@ +error: multiple renamings were specified for library `foo` + +error: aborting due to previous error + diff --git a/tests/ui/rfcs/rfc-1717-dllimport/rename-modifiers.rs b/tests/ui/rfcs/rfc-1717-dllimport/rename-modifiers.rs new file mode 100644 index 000000000..30f4db718 --- /dev/null +++ b/tests/ui/rfcs/rfc-1717-dllimport/rename-modifiers.rs @@ -0,0 +1,9 @@ +// compile-flags: -l dylib=foo:bar +// error-pattern: overriding linking modifiers from command line is not supported + +#![feature(native_link_modifiers_as_needed)] + +#![crate_type = "lib"] + +#[link(name = "foo", kind = "dylib", modifiers = "-as-needed")] +extern "C" {} diff --git a/tests/ui/rfcs/rfc-1717-dllimport/rename-modifiers.stderr b/tests/ui/rfcs/rfc-1717-dllimport/rename-modifiers.stderr new file mode 100644 index 000000000..bee639bf2 --- /dev/null +++ b/tests/ui/rfcs/rfc-1717-dllimport/rename-modifiers.stderr @@ -0,0 +1,8 @@ +error: overriding linking modifiers from command line is not supported + --> $DIR/rename-modifiers.rs:9:1 + | +LL | extern "C" {} + | ^^^^^^^^^^^^^ + +error: aborting due to previous error + diff --git a/tests/ui/rfcs/rfc-1717-dllimport/rename-to-empty.rs b/tests/ui/rfcs/rfc-1717-dllimport/rename-to-empty.rs new file mode 100644 index 000000000..9356c4129 --- /dev/null +++ b/tests/ui/rfcs/rfc-1717-dllimport/rename-to-empty.rs @@ -0,0 +1,7 @@ +// compile-flags: -l foo: +// error-pattern: an empty renaming target was specified for library + +#![crate_type = "lib"] + +#[link(name = "foo")] +extern "C" {} diff --git a/tests/ui/rfcs/rfc-1717-dllimport/rename-to-empty.stderr b/tests/ui/rfcs/rfc-1717-dllimport/rename-to-empty.stderr new file mode 100644 index 000000000..aca839d80 --- /dev/null +++ b/tests/ui/rfcs/rfc-1717-dllimport/rename-to-empty.stderr @@ -0,0 +1,4 @@ +error: an empty renaming target was specified for library `foo` + +error: aborting due to previous error + -- cgit v1.2.3