From 1ece1ea48c0d9e4c8414abf872626f7a54747976 Mon Sep 17 00:00:00 2001 From: Daniel Paoliello Date: Mon, 27 Mar 2023 10:42:22 -0700 Subject: [PATCH] Stablize raw-dylib, link_ordinal and -Cdlltool --- compiler/rustc_codegen_llvm/messages.ftl | 2 +- .../rustc_codegen_llvm/src/back/archive.rs | 12 ++++--- compiler/rustc_codegen_llvm/src/errors.rs | 3 +- .../rustc_codegen_ssa/src/codegen_attrs.rs | 9 ----- compiler/rustc_feature/src/accepted.rs | 2 ++ compiler/rustc_feature/src/active.rs | 2 -- compiler/rustc_interface/src/tests.rs | 2 +- compiler/rustc_metadata/src/native_libs.rs | 18 ---------- compiler/rustc_session/src/options.rs | 4 +-- src/doc/rustc/src/codegen-options/index.md | 8 +++++ .../src/language-features/raw-dylib.md | 34 ------------------ src/tools/compiletest/src/header/needs.rs | 36 ++++++++++++++++--- .../raw-dylib-alt-calling-convention/lib.rs | 1 - tests/run-make/raw-dylib-c/lib.rs | 2 -- .../raw-dylib-cross-compilation/lib.rs | 1 - .../raw-dylib-custom-dlltool/Makefile | 11 ++++++ .../run-make/raw-dylib-custom-dlltool/lib.rs | 10 ++++++ .../raw-dylib-custom-dlltool/output.txt | 1 + .../raw-dylib-custom-dlltool/script.cmd | 2 ++ .../raw-dylib-import-name-type/driver.rs | 1 - .../raw-dylib-inline-cross-dylib/driver.rs | 2 -- .../raw-dylib-inline-cross-dylib/lib.rs | 2 -- tests/run-make/raw-dylib-link-ordinal/lib.rs | 2 -- .../run-make/raw-dylib-stdcall-ordinal/lib.rs | 2 -- .../feature-gates/feature-gate-raw-dylib-2.rs | 12 ------- .../feature-gate-raw-dylib-2.stderr | 21 ----------- ...feature-gate-raw-dylib-import-name-type.rs | 8 ----- ...ure-gate-raw-dylib-import-name-type.stderr | 21 ----------- .../feature-gates/feature-gate-raw-dylib.rs | 7 ---- .../feature-gate-raw-dylib.stderr | 12 ------- tests/ui/rfc-2627-raw-dylib/dlltool-failed.rs | 19 ++++++++++ .../rfc-2627-raw-dylib/dlltool-failed.stderr | 5 +++ .../import-name-type-invalid-format.rs | 2 -- .../import-name-type-invalid-format.stderr | 2 +- .../import-name-type-multiple.rs | 2 -- .../import-name-type-multiple.stderr | 2 +- .../import-name-type-unknown-value.rs | 2 -- .../import-name-type-unknown-value.stderr | 2 +- .../import-name-type-unsupported-link-kind.rs | 2 -- ...ort-name-type-unsupported-link-kind.stderr | 4 +-- .../ui/rfc-2627-raw-dylib/invalid-dlltool.rs | 13 +++++++ .../rfc-2627-raw-dylib/invalid-dlltool.stderr | 4 +++ .../link-ordinal-and-name.rs | 2 -- .../link-ordinal-and-name.stderr | 4 +-- .../link-ordinal-invalid-format.rs | 2 -- .../link-ordinal-invalid-format.stderr | 4 +-- .../link-ordinal-missing-argument.rs | 2 -- .../link-ordinal-missing-argument.stderr | 4 +-- .../link-ordinal-multiple.rs | 2 -- .../link-ordinal-multiple.stderr | 8 ++--- .../link-ordinal-not-foreign-fn.rs | 2 -- .../link-ordinal-not-foreign-fn.stderr | 6 ++-- .../link-ordinal-too-large.rs | 2 -- .../link-ordinal-too-large.stderr | 4 +-- .../link-ordinal-too-many-arguments.rs | 2 -- .../link-ordinal-too-many-arguments.stderr | 4 +-- .../link-ordinal-unsupported-link-kind.rs | 2 -- .../link-ordinal-unsupported-link-kind.stderr | 4 +-- .../multiple-declarations.rs | 1 - .../multiple-declarations.stderr | 2 +- .../raw-dylib-windows-only.rs | 1 - .../raw-dylib-windows-only.stderr | 2 +- 62 files changed, 146 insertions(+), 223 deletions(-) delete mode 100644 src/doc/unstable-book/src/language-features/raw-dylib.md create mode 100644 tests/run-make/raw-dylib-custom-dlltool/Makefile create mode 100644 tests/run-make/raw-dylib-custom-dlltool/lib.rs create mode 100644 tests/run-make/raw-dylib-custom-dlltool/output.txt create mode 100644 tests/run-make/raw-dylib-custom-dlltool/script.cmd delete mode 100644 tests/ui/feature-gates/feature-gate-raw-dylib-2.rs delete mode 100644 tests/ui/feature-gates/feature-gate-raw-dylib-2.stderr delete mode 100644 tests/ui/feature-gates/feature-gate-raw-dylib-import-name-type.rs delete mode 100644 tests/ui/feature-gates/feature-gate-raw-dylib-import-name-type.stderr delete mode 100644 tests/ui/feature-gates/feature-gate-raw-dylib.rs delete mode 100644 tests/ui/feature-gates/feature-gate-raw-dylib.stderr create mode 100644 tests/ui/rfc-2627-raw-dylib/dlltool-failed.rs create mode 100644 tests/ui/rfc-2627-raw-dylib/dlltool-failed.stderr create mode 100644 tests/ui/rfc-2627-raw-dylib/invalid-dlltool.rs create mode 100644 tests/ui/rfc-2627-raw-dylib/invalid-dlltool.stderr diff --git a/compiler/rustc_codegen_llvm/messages.ftl b/compiler/rustc_codegen_llvm/messages.ftl index b6d7484bccefd..2e3adc0866931 100644 --- a/compiler/rustc_codegen_llvm/messages.ftl +++ b/compiler/rustc_codegen_llvm/messages.ftl @@ -24,7 +24,7 @@ codegen_llvm_error_writing_def_file = Error writing .DEF file: {$error} codegen_llvm_error_calling_dlltool = - Error calling dlltool: {$error} + Error calling dlltool '{$dlltool_path}': {$error} codegen_llvm_dlltool_fail_import_library = Dlltool could not create import library: {$stdout} diff --git a/compiler/rustc_codegen_llvm/src/back/archive.rs b/compiler/rustc_codegen_llvm/src/back/archive.rs index 12da21dc47772..a6416e9540cc0 100644 --- a/compiler/rustc_codegen_llvm/src/back/archive.rs +++ b/compiler/rustc_codegen_llvm/src/back/archive.rs @@ -198,7 +198,7 @@ impl ArchiveBuilderBuilder for LlvmArchiveBuilderBuilder { "arm" => ("arm", "--32"), _ => panic!("unsupported arch {}", sess.target.arch), }; - let result = std::process::Command::new(dlltool) + let result = std::process::Command::new(&dlltool) .args([ "-d", def_file_path.to_str().unwrap(), @@ -218,9 +218,13 @@ impl ArchiveBuilderBuilder for LlvmArchiveBuilderBuilder { match result { Err(e) => { - sess.emit_fatal(ErrorCallingDllTool { error: e }); + sess.emit_fatal(ErrorCallingDllTool { + dlltool_path: dlltool.to_string_lossy(), + error: e, + }); } - Ok(output) if !output.status.success() => { + // dlltool returns '0' on failure, so check for error output instead. + Ok(output) if !output.stderr.is_empty() => { sess.emit_fatal(DlltoolFailImportLibrary { stdout: String::from_utf8_lossy(&output.stdout), stderr: String::from_utf8_lossy(&output.stderr), @@ -431,7 +435,7 @@ fn string_to_io_error(s: String) -> io::Error { fn find_binutils_dlltool(sess: &Session) -> OsString { assert!(sess.target.options.is_like_windows && !sess.target.options.is_like_msvc); - if let Some(dlltool_path) = &sess.opts.unstable_opts.dlltool { + if let Some(dlltool_path) = &sess.opts.cg.dlltool { return dlltool_path.clone().into_os_string(); } diff --git a/compiler/rustc_codegen_llvm/src/errors.rs b/compiler/rustc_codegen_llvm/src/errors.rs index bae88d942934c..672087de31555 100644 --- a/compiler/rustc_codegen_llvm/src/errors.rs +++ b/compiler/rustc_codegen_llvm/src/errors.rs @@ -67,7 +67,8 @@ pub(crate) struct ErrorWritingDEFFile { #[derive(Diagnostic)] #[diag(codegen_llvm_error_calling_dlltool)] -pub(crate) struct ErrorCallingDllTool { +pub(crate) struct ErrorCallingDllTool<'a> { + pub dlltool_path: Cow<'a, str>, pub error: std::io::Error, } diff --git a/compiler/rustc_codegen_ssa/src/codegen_attrs.rs b/compiler/rustc_codegen_ssa/src/codegen_attrs.rs index 8542bab689d6d..87d42a89a8207 100644 --- a/compiler/rustc_codegen_ssa/src/codegen_attrs.rs +++ b/compiler/rustc_codegen_ssa/src/codegen_attrs.rs @@ -594,15 +594,6 @@ fn should_inherit_track_caller(tcx: TyCtxt<'_>, def_id: DefId) -> bool { fn check_link_ordinal(tcx: TyCtxt<'_>, attr: &ast::Attribute) -> Option { use rustc_ast::{LitIntType, LitKind, MetaItemLit}; - if !tcx.features().raw_dylib && tcx.sess.target.arch == "x86" { - feature_err( - &tcx.sess.parse_sess, - sym::raw_dylib, - attr.span, - "`#[link_ordinal]` is unstable on x86", - ) - .emit(); - } let meta_item_list = attr.meta_item_list(); let meta_item_list = meta_item_list.as_deref(); let sole_meta_list = match meta_item_list { diff --git a/compiler/rustc_feature/src/accepted.rs b/compiler/rustc_feature/src/accepted.rs index 3d644de166526..1c9ef342fecc3 100644 --- a/compiler/rustc_feature/src/accepted.rs +++ b/compiler/rustc_feature/src/accepted.rs @@ -278,6 +278,8 @@ declare_features! ( (accepted, pub_restricted, "1.18.0", Some(32409), None), /// Allows use of the postfix `?` operator in expressions. (accepted, question_mark, "1.13.0", Some(31436), None), + /// Allows the use of raw-dylibs (RFC 2627). + (accepted, raw_dylib, "CURRENT_RUSTC_VERSION", Some(58713), None), /// Allows keywords to be escaped for use as identifiers. (accepted, raw_identifiers, "1.30.0", Some(48589), None), /// Allows relaxing the coherence rules such that diff --git a/compiler/rustc_feature/src/active.rs b/compiler/rustc_feature/src/active.rs index 48f5bd1cb5048..68f511cf8b848 100644 --- a/compiler/rustc_feature/src/active.rs +++ b/compiler/rustc_feature/src/active.rs @@ -485,8 +485,6 @@ declare_features! ( (active, precise_pointer_size_matching, "1.32.0", Some(56354), None), /// Allows macro attributes on expressions, statements and non-inline modules. (active, proc_macro_hygiene, "1.30.0", Some(54727), None), - /// Allows the use of raw-dylibs (RFC 2627). - (active, raw_dylib, "1.65.0", Some(58713), None), /// Allows `&raw const $place_expr` and `&raw mut $place_expr` expressions. (active, raw_ref_op, "1.41.0", Some(64490), None), /// Allows using the `#[register_tool]` attribute. diff --git a/compiler/rustc_interface/src/tests.rs b/compiler/rustc_interface/src/tests.rs index 10dfd32d418a2..efac621d947e4 100644 --- a/compiler/rustc_interface/src/tests.rs +++ b/compiler/rustc_interface/src/tests.rs @@ -547,6 +547,7 @@ fn test_codegen_options_tracking_hash() { untracked!(ar, String::from("abc")); untracked!(codegen_units, Some(42)); untracked!(default_linker_libraries, true); + untracked!(dlltool, Some(PathBuf::from("custom_dlltool.exe"))); untracked!(extra_filename, String::from("extra-filename")); untracked!(incremental, Some(String::from("abc"))); // `link_arg` is omitted because it just forwards to `link_args`. @@ -651,7 +652,6 @@ fn test_unstable_options_tracking_hash() { untracked!(assert_incr_state, Some(String::from("loaded"))); untracked!(deduplicate_diagnostics, false); untracked!(dep_tasks, true); - untracked!(dlltool, Some(PathBuf::from("custom_dlltool.exe"))); untracked!(dont_buffer_diagnostics, true); untracked!(dump_dep_graph, true); untracked!(dump_drop_tracking_cfg, Some("cfg.dot".to_string())); diff --git a/compiler/rustc_metadata/src/native_libs.rs b/compiler/rustc_metadata/src/native_libs.rs index b855c8e433266..d3ad32752c62f 100644 --- a/compiler/rustc_metadata/src/native_libs.rs +++ b/compiler/rustc_metadata/src/native_libs.rs @@ -161,14 +161,6 @@ impl<'tcx> Collector<'tcx> { "raw-dylib" => { if !sess.target.is_like_windows { sess.emit_err(errors::FrameworkOnlyWindows { span }); - } else if !features.raw_dylib && sess.target.arch == "x86" { - feature_err( - &sess.parse_sess, - sym::raw_dylib, - span, - "link kind `raw-dylib` is unstable on x86", - ) - .emit(); } NativeLibKind::RawDylib } @@ -251,16 +243,6 @@ impl<'tcx> Collector<'tcx> { continue; } }; - if !features.raw_dylib { - let span = item.name_value_literal_span().unwrap(); - feature_err( - &sess.parse_sess, - sym::raw_dylib, - span, - "import name type is unstable", - ) - .emit(); - } import_name_type = Some((link_import_name_type, item.span())); } _ => { diff --git a/compiler/rustc_session/src/options.rs b/compiler/rustc_session/src/options.rs index 631dd0a2146e8..d43e87f795006 100644 --- a/compiler/rustc_session/src/options.rs +++ b/compiler/rustc_session/src/options.rs @@ -1235,6 +1235,8 @@ options! { line-tables-only, limited, or full; default: 0)"), default_linker_libraries: bool = (false, parse_bool, [UNTRACKED], "allow the linker to link its default libraries (default: no)"), + dlltool: Option = (None, parse_opt_pathbuf, [UNTRACKED], + "import library generation tool (ignored except when targeting windows-gnu)"), embed_bitcode: bool = (true, parse_bool, [TRACKED], "emit bitcode in rlibs (default: yes)"), extra_filename: String = (String::new(), parse_string, [UNTRACKED], @@ -1391,8 +1393,6 @@ options! { (default: no)"), diagnostic_width: Option = (None, parse_opt_number, [UNTRACKED], "set the current output width for diagnostic truncation"), - dlltool: Option = (None, parse_opt_pathbuf, [UNTRACKED], - "import library generation tool (windows-gnu only)"), dont_buffer_diagnostics: bool = (false, parse_bool, [UNTRACKED], "emit diagnostics rather than buffering (breaks NLL error downgrading, sorting) \ (default: no)"), diff --git a/src/doc/rustc/src/codegen-options/index.md b/src/doc/rustc/src/codegen-options/index.md index d7c6a884fc8fb..b7fa7243cc1c0 100644 --- a/src/doc/rustc/src/codegen-options/index.md +++ b/src/doc/rustc/src/codegen-options/index.md @@ -90,6 +90,14 @@ It takes one of the following values: For example, for gcc flavor linkers, this issues the `-nodefaultlibs` flag to the linker. +## dlltool + +On `windows-gnu` targets, this flag controls which dlltool `rustc` invokes to +generate import libraries when using the [`raw-dylib` link kind](../../reference/items/external-blocks.md#the-link-attribute). +It takes a path to [the dlltool executable](https://sourceware.org/binutils/docs/binutils/dlltool.html). +If this flag is not specified, a dlltool executable will be inferred based on +the host environment and target. + ## embed-bitcode This flag controls whether or not the compiler embeds LLVM bitcode into object diff --git a/src/doc/unstable-book/src/language-features/raw-dylib.md b/src/doc/unstable-book/src/language-features/raw-dylib.md deleted file mode 100644 index 5fd208ae7571c..0000000000000 --- a/src/doc/unstable-book/src/language-features/raw-dylib.md +++ /dev/null @@ -1,34 +0,0 @@ -# `raw_dylib` - -The tracking issue for this feature is: [#58713] - -[#58713]: https://github.com/rust-lang/rust/issues/58713 - ------------------------- - -The `raw_dylib` feature allows you to link against the implementations of functions in an `extern` -block without, on Windows, linking against an import library. - -```rust,ignore (partial-example) -#![feature(raw_dylib)] - -#[link(name="library", kind="raw-dylib")] -extern { - fn extern_function(x: i32); -} - -fn main() { - unsafe { - extern_function(14); - } -} -``` - -## Limitations - -This feature is unstable for the `x86` architecture, and stable for all other architectures. - -This feature is only supported on Windows. - -On the `x86` architecture, this feature supports only the `cdecl`, `stdcall`, `system`, `fastcall`, and -`vectorcall` calling conventions. diff --git a/src/tools/compiletest/src/header/needs.rs b/src/tools/compiletest/src/header/needs.rs index 81179480ed810..4a57c61406ce4 100644 --- a/src/tools/compiletest/src/header/needs.rs +++ b/src/tools/compiletest/src/header/needs.rs @@ -115,6 +115,11 @@ pub(super) fn handle_needs( condition: cache.x86_64_dlltool, ignore_reason: "ignored when dlltool for x86_64 is not present", }, + Need { + name: "needs-dlltool", + condition: cache.dlltool, + ignore_reason: "ignored when dlltool for the current architecture is not present", + }, Need { name: "needs-git-hash", condition: config.git_hash, @@ -183,6 +188,7 @@ pub(super) struct CachedNeedsConditions { rust_lld: bool, i686_dlltool: bool, x86_64_dlltool: bool, + dlltool: bool, } impl CachedNeedsConditions { @@ -190,6 +196,17 @@ impl CachedNeedsConditions { let path = std::env::var_os("PATH").expect("missing PATH environment variable"); let path = std::env::split_paths(&path).collect::>(); + // On Windows, dlltool.exe is used for all architectures. + #[cfg(windows)] + let dlltool = path.iter().any(|dir| dir.join("dlltool.exe").is_file()); + + // For non-Windows, there are architecture specific dlltool binaries. + #[cfg(not(windows))] + let i686_dlltool = path.iter().any(|dir| dir.join("i686-w64-mingw32-dlltool").is_file()); + #[cfg(not(windows))] + let x86_64_dlltool = + path.iter().any(|dir| dir.join("x86_64-w64-mingw32-dlltool").is_file()); + let target = &&*config.target; Self { sanitizer_support: std::env::var_os("RUSTC_SANITIZER_SUPPORT").is_some(), @@ -225,17 +242,26 @@ impl CachedNeedsConditions { .join(if config.host.contains("windows") { "rust-lld.exe" } else { "rust-lld" }) .exists(), - // On Windows, dlltool.exe is used for all architectures. #[cfg(windows)] - i686_dlltool: path.iter().any(|dir| dir.join("dlltool.exe").is_file()), + i686_dlltool: dlltool, #[cfg(windows)] - x86_64_dlltool: path.iter().any(|dir| dir.join("dlltool.exe").is_file()), + x86_64_dlltool: dlltool, + #[cfg(windows)] + dlltool, // For non-Windows, there are architecture specific dlltool binaries. #[cfg(not(windows))] - i686_dlltool: path.iter().any(|dir| dir.join("i686-w64-mingw32-dlltool").is_file()), + i686_dlltool, + #[cfg(not(windows))] + x86_64_dlltool, #[cfg(not(windows))] - x86_64_dlltool: path.iter().any(|dir| dir.join("x86_64-w64-mingw32-dlltool").is_file()), + dlltool: if config.matches_arch("x86") { + i686_dlltool + } else if config.matches_arch("x86_64") { + x86_64_dlltool + } else { + false + }, } } } diff --git a/tests/run-make/raw-dylib-alt-calling-convention/lib.rs b/tests/run-make/raw-dylib-alt-calling-convention/lib.rs index 22f222c12c39b..dcb5fee9ecc76 100644 --- a/tests/run-make/raw-dylib-alt-calling-convention/lib.rs +++ b/tests/run-make/raw-dylib-alt-calling-convention/lib.rs @@ -1,5 +1,4 @@ #![feature(abi_vectorcall)] -#![cfg_attr(target_arch = "x86", feature(raw_dylib))] #[repr(C)] #[derive(Clone)] diff --git a/tests/run-make/raw-dylib-c/lib.rs b/tests/run-make/raw-dylib-c/lib.rs index 5fb1204037c93..f17125f308c20 100644 --- a/tests/run-make/raw-dylib-c/lib.rs +++ b/tests/run-make/raw-dylib-c/lib.rs @@ -1,5 +1,3 @@ -#![feature(raw_dylib)] - #[link(name = "extern_1.dll", kind = "raw-dylib", modifiers = "+verbatim")] extern { fn extern_fn_1(); diff --git a/tests/run-make/raw-dylib-cross-compilation/lib.rs b/tests/run-make/raw-dylib-cross-compilation/lib.rs index 51bf2ec6b6e11..3338ac0a0b50f 100644 --- a/tests/run-make/raw-dylib-cross-compilation/lib.rs +++ b/tests/run-make/raw-dylib-cross-compilation/lib.rs @@ -1,4 +1,3 @@ -#![feature(raw_dylib)] #![feature(no_core, lang_items)] #![no_std] #![no_core] diff --git a/tests/run-make/raw-dylib-custom-dlltool/Makefile b/tests/run-make/raw-dylib-custom-dlltool/Makefile new file mode 100644 index 0000000000000..f5d5360a3fbe8 --- /dev/null +++ b/tests/run-make/raw-dylib-custom-dlltool/Makefile @@ -0,0 +1,11 @@ +# Test using -Cdlltool to change where raw-dylib looks for the dlltool binary. + +# only-windows +# only-gnu +# needs-dlltool + +include ../tools.mk + +all: + $(RUSTC) --crate-type lib --crate-name raw_dylib_test lib.rs -Cdlltool=$(CURDIR)/script.cmd + $(DIFF) output.txt "$(TMPDIR)"/output.txt diff --git a/tests/run-make/raw-dylib-custom-dlltool/lib.rs b/tests/run-make/raw-dylib-custom-dlltool/lib.rs new file mode 100644 index 0000000000000..2f3f497a00de1 --- /dev/null +++ b/tests/run-make/raw-dylib-custom-dlltool/lib.rs @@ -0,0 +1,10 @@ +#[link(name = "extern_1", kind = "raw-dylib")] +extern { + fn extern_fn_1(); +} + +pub fn library_function() { + unsafe { + extern_fn_1(); + } +} diff --git a/tests/run-make/raw-dylib-custom-dlltool/output.txt b/tests/run-make/raw-dylib-custom-dlltool/output.txt new file mode 100644 index 0000000000000..6dd9466d26ddc --- /dev/null +++ b/tests/run-make/raw-dylib-custom-dlltool/output.txt @@ -0,0 +1 @@ +Called dlltool via script.cmd diff --git a/tests/run-make/raw-dylib-custom-dlltool/script.cmd b/tests/run-make/raw-dylib-custom-dlltool/script.cmd new file mode 100644 index 0000000000000..95f85c61c67d2 --- /dev/null +++ b/tests/run-make/raw-dylib-custom-dlltool/script.cmd @@ -0,0 +1,2 @@ +echo Called dlltool via script.cmd> %TMPDIR%\output.txt +dlltool.exe %* diff --git a/tests/run-make/raw-dylib-import-name-type/driver.rs b/tests/run-make/raw-dylib-import-name-type/driver.rs index 9a3cd9ebe1b4b..6c1c212f187b7 100644 --- a/tests/run-make/raw-dylib-import-name-type/driver.rs +++ b/tests/run-make/raw-dylib-import-name-type/driver.rs @@ -1,4 +1,3 @@ -#![feature(raw_dylib)] #![feature(abi_vectorcall)] #[link(name = "extern", kind = "raw-dylib", import_name_type = "undecorated")] diff --git a/tests/run-make/raw-dylib-inline-cross-dylib/driver.rs b/tests/run-make/raw-dylib-inline-cross-dylib/driver.rs index f72ded7d9f638..0c3125be6f596 100644 --- a/tests/run-make/raw-dylib-inline-cross-dylib/driver.rs +++ b/tests/run-make/raw-dylib-inline-cross-dylib/driver.rs @@ -1,5 +1,3 @@ -#![feature(raw_dylib)] - extern crate raw_dylib_test; extern crate raw_dylib_test_wrapper; diff --git a/tests/run-make/raw-dylib-inline-cross-dylib/lib.rs b/tests/run-make/raw-dylib-inline-cross-dylib/lib.rs index 00c2c1c42d15f..4877cb80aea5e 100644 --- a/tests/run-make/raw-dylib-inline-cross-dylib/lib.rs +++ b/tests/run-make/raw-dylib-inline-cross-dylib/lib.rs @@ -1,5 +1,3 @@ -#![feature(raw_dylib)] - #[link(name = "extern_1", kind = "raw-dylib")] extern { fn extern_fn_1(); diff --git a/tests/run-make/raw-dylib-link-ordinal/lib.rs b/tests/run-make/raw-dylib-link-ordinal/lib.rs index bb25ac64c613b..1bbb45bbc7725 100644 --- a/tests/run-make/raw-dylib-link-ordinal/lib.rs +++ b/tests/run-make/raw-dylib-link-ordinal/lib.rs @@ -1,5 +1,3 @@ -#![cfg_attr(target_arch = "x86", feature(raw_dylib))] - #[link(name = "exporter", kind = "raw-dylib")] extern { #[link_ordinal(13)] diff --git a/tests/run-make/raw-dylib-stdcall-ordinal/lib.rs b/tests/run-make/raw-dylib-stdcall-ordinal/lib.rs index b7921396a0f4d..74c5c7f8250b2 100644 --- a/tests/run-make/raw-dylib-stdcall-ordinal/lib.rs +++ b/tests/run-make/raw-dylib-stdcall-ordinal/lib.rs @@ -1,5 +1,3 @@ -#![cfg_attr(target_arch = "x86", feature(raw_dylib))] - #[link(name = "exporter", kind = "raw-dylib")] extern "stdcall" { #[link_ordinal(15)] diff --git a/tests/ui/feature-gates/feature-gate-raw-dylib-2.rs b/tests/ui/feature-gates/feature-gate-raw-dylib-2.rs deleted file mode 100644 index fc47a9061d3c0..0000000000000 --- a/tests/ui/feature-gates/feature-gate-raw-dylib-2.rs +++ /dev/null @@ -1,12 +0,0 @@ -// only-x86 -#[link(name = "foo")] -extern "C" { - #[link_ordinal(42)] - //~^ ERROR: `#[link_ordinal]` is unstable on x86 - fn foo(); - #[link_ordinal(5)] - //~^ ERROR: `#[link_ordinal]` is unstable on x86 - static mut imported_variable: i32; -} - -fn main() {} diff --git a/tests/ui/feature-gates/feature-gate-raw-dylib-2.stderr b/tests/ui/feature-gates/feature-gate-raw-dylib-2.stderr deleted file mode 100644 index 0e900760d245e..0000000000000 --- a/tests/ui/feature-gates/feature-gate-raw-dylib-2.stderr +++ /dev/null @@ -1,21 +0,0 @@ -error[E0658]: `#[link_ordinal]` is unstable on x86 - --> $DIR/feature-gate-raw-dylib-2.rs:4:5 - | -LL | #[link_ordinal(42)] - | ^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #58713 for more information - = help: add `#![feature(raw_dylib)]` to the crate attributes to enable - -error[E0658]: `#[link_ordinal]` is unstable on x86 - --> $DIR/feature-gate-raw-dylib-2.rs:7:5 - | -LL | #[link_ordinal(5)] - | ^^^^^^^^^^^^^^^^^^ - | - = note: see issue #58713 for more information - = help: add `#![feature(raw_dylib)]` to the crate attributes to enable - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/feature-gates/feature-gate-raw-dylib-import-name-type.rs b/tests/ui/feature-gates/feature-gate-raw-dylib-import-name-type.rs deleted file mode 100644 index 295f502d6a3e5..0000000000000 --- a/tests/ui/feature-gates/feature-gate-raw-dylib-import-name-type.rs +++ /dev/null @@ -1,8 +0,0 @@ -// only-windows -// only-x86 -#[link(name = "foo", kind = "raw-dylib", import_name_type = "decorated")] -//~^ ERROR link kind `raw-dylib` is unstable on x86 -//~| ERROR import name type is unstable -extern "C" {} - -fn main() {} diff --git a/tests/ui/feature-gates/feature-gate-raw-dylib-import-name-type.stderr b/tests/ui/feature-gates/feature-gate-raw-dylib-import-name-type.stderr deleted file mode 100644 index d6b165b7610a5..0000000000000 --- a/tests/ui/feature-gates/feature-gate-raw-dylib-import-name-type.stderr +++ /dev/null @@ -1,21 +0,0 @@ -error[E0658]: link kind `raw-dylib` is unstable on x86 - --> $DIR/feature-gate-raw-dylib-import-name-type.rs:3:29 - | -LL | #[link(name = "foo", kind = "raw-dylib", import_name_type = "decorated")] - | ^^^^^^^^^^^ - | - = note: see issue #58713 for more information - = help: add `#![feature(raw_dylib)]` to the crate attributes to enable - -error[E0658]: import name type is unstable - --> $DIR/feature-gate-raw-dylib-import-name-type.rs:3:61 - | -LL | #[link(name = "foo", kind = "raw-dylib", import_name_type = "decorated")] - | ^^^^^^^^^^^ - | - = note: see issue #58713 for more information - = help: add `#![feature(raw_dylib)]` to the crate attributes to enable - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/feature-gates/feature-gate-raw-dylib.rs b/tests/ui/feature-gates/feature-gate-raw-dylib.rs deleted file mode 100644 index 291cca8fd2573..0000000000000 --- a/tests/ui/feature-gates/feature-gate-raw-dylib.rs +++ /dev/null @@ -1,7 +0,0 @@ -// only-windows -// only-x86 -#[link(name = "foo", kind = "raw-dylib")] -//~^ ERROR: link kind `raw-dylib` is unstable on x86 -extern "C" {} - -fn main() {} diff --git a/tests/ui/feature-gates/feature-gate-raw-dylib.stderr b/tests/ui/feature-gates/feature-gate-raw-dylib.stderr deleted file mode 100644 index f02241e4908c0..0000000000000 --- a/tests/ui/feature-gates/feature-gate-raw-dylib.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0658]: link kind `raw-dylib` is unstable on x86 - --> $DIR/feature-gate-raw-dylib.rs:3:29 - | -LL | #[link(name = "foo", kind = "raw-dylib")] - | ^^^^^^^^^^^ - | - = note: see issue #58713 for more information - = help: add `#![feature(raw_dylib)]` to the crate attributes to enable - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/rfc-2627-raw-dylib/dlltool-failed.rs b/tests/ui/rfc-2627-raw-dylib/dlltool-failed.rs new file mode 100644 index 0000000000000..d7a418959bf51 --- /dev/null +++ b/tests/ui/rfc-2627-raw-dylib/dlltool-failed.rs @@ -0,0 +1,19 @@ +// Tests that dlltool failing to generate an import library will raise an error. + +// only-gnu +// only-windows +// needs-dlltool +// compile-flags: --crate-type lib --emit link +// normalize-stderr-test: "[^ ']*/dlltool.exe" -> "$$DLLTOOL" +// normalize-stderr-test: "[^ ]*/foo.def" -> "$$DEF_FILE" +#[link(name = "foo", kind = "raw-dylib")] +extern "C" { + // `@1` is an invalid name to export, as it usually indicates that something + // is being exported via ordinal. + #[link_name = "@1"] + fn f(x: i32); +} + +pub fn lib_main() { + unsafe { f(42); } +} diff --git a/tests/ui/rfc-2627-raw-dylib/dlltool-failed.stderr b/tests/ui/rfc-2627-raw-dylib/dlltool-failed.stderr new file mode 100644 index 0000000000000..020ac6a2b670b --- /dev/null +++ b/tests/ui/rfc-2627-raw-dylib/dlltool-failed.stderr @@ -0,0 +1,5 @@ +error: Dlltool could not create import library: + $DLLTOOL: Syntax error in def file $DEF_FILE:1 + +error: aborting due to previous error + 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 index 22d57f8bedddc..7bc44d65be9e5 100644 --- 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 @@ -1,7 +1,5 @@ // 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" { } 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 index 0e95fec29d257..fb70b987fc7d9 100644 --- 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 @@ -1,5 +1,5 @@ error: import name type must be of the form `import_name_type = "string"` - --> $DIR/import-name-type-invalid-format.rs:5:42 + --> $DIR/import-name-type-invalid-format.rs:3:42 | LL | #[link(name = "foo", kind = "raw-dylib", import_name_type = 6)] | ^^^^^^^^^^^^^^^^^^^^ 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 index 7ccb0082fb976..b96f61a26da8b 100644 --- a/tests/ui/rfc-2627-raw-dylib/import-name-type-multiple.rs +++ b/tests/ui/rfc-2627-raw-dylib/import-name-type-multiple.rs @@ -1,8 +1,6 @@ // 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" { } 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 index 7c0e0be911f73..9533061892fee 100644 --- a/tests/ui/rfc-2627-raw-dylib/import-name-type-multiple.stderr +++ b/tests/ui/rfc-2627-raw-dylib/import-name-type-multiple.stderr @@ -1,5 +1,5 @@ error: multiple `import_name_type` arguments in a single `#[link]` attribute - --> $DIR/import-name-type-multiple.rs:6:74 + --> $DIR/import-name-type-multiple.rs:4:74 | LL | #[link(name = "foo", kind = "raw-dylib", import_name_type = "decorated", import_name_type = "decorated")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 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 index f728a578d3b8a..067e82a17fdc5 100644 --- 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 @@ -1,7 +1,5 @@ // 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" { } 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 index 2b299f2fea316..2bce9758e997c 100644 --- 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 @@ -1,5 +1,5 @@ error: unknown import name type `unknown`, expected one of: decorated, noprefix, undecorated - --> $DIR/import-name-type-unknown-value.rs:5:42 + --> $DIR/import-name-type-unknown-value.rs:3:42 | LL | #[link(name = "foo", kind = "raw-dylib", import_name_type = "unknown")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 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 index ae9207864a2ae..34e907bde839a 100644 --- 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 @@ -1,7 +1,5 @@ // 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" { } 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 index 5898cd875a1c8..75cadc471c437 100644 --- 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 @@ -1,11 +1,11 @@ error: import name type can only be used with link kind `raw-dylib` - --> $DIR/import-name-type-unsupported-link-kind.rs:5:22 + --> $DIR/import-name-type-unsupported-link-kind.rs:3: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 + --> $DIR/import-name-type-unsupported-link-kind.rs:7:39 | LL | #[link(name = "bar", kind = "static", import_name_type = "decorated")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/rfc-2627-raw-dylib/invalid-dlltool.rs b/tests/ui/rfc-2627-raw-dylib/invalid-dlltool.rs new file mode 100644 index 0000000000000..a07be9d92b4ed --- /dev/null +++ b/tests/ui/rfc-2627-raw-dylib/invalid-dlltool.rs @@ -0,0 +1,13 @@ +// Tests that failing to run dlltool will raise an error. + +// only-gnu +// only-windows +// compile-flags: --crate-type lib --emit link -Cdlltool=does_not_exit.exe +#[link(name = "foo", kind = "raw-dylib")] +extern "C" { + fn f(x: i32); +} + +pub fn lib_main() { + unsafe { f(42); } +} diff --git a/tests/ui/rfc-2627-raw-dylib/invalid-dlltool.stderr b/tests/ui/rfc-2627-raw-dylib/invalid-dlltool.stderr new file mode 100644 index 0000000000000..3ae901e0dbc94 --- /dev/null +++ b/tests/ui/rfc-2627-raw-dylib/invalid-dlltool.stderr @@ -0,0 +1,4 @@ +error: Error calling dlltool 'does_not_exit.exe': program not found + +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 index 1a128c87a0c30..b04c2facbcdf3 100644 --- a/tests/ui/rfc-2627-raw-dylib/link-ordinal-and-name.rs +++ b/tests/ui/rfc-2627-raw-dylib/link-ordinal-and-name.rs @@ -1,5 +1,3 @@ -#![cfg_attr(target_arch = "x86", feature(raw_dylib))] - #[link(name="foo")] extern "C" { #[link_name="foo"] 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 index 481a06d2797d5..f1e54d37827c0 100644 --- a/tests/ui/rfc-2627-raw-dylib/link-ordinal-and-name.stderr +++ b/tests/ui/rfc-2627-raw-dylib/link-ordinal-and-name.stderr @@ -1,11 +1,11 @@ error: cannot use `#[link_name]` with `#[link_ordinal]` - --> $DIR/link-ordinal-and-name.rs:6:5 + --> $DIR/link-ordinal-and-name.rs:4:5 | LL | #[link_ordinal(42)] | ^^^^^^^^^^^^^^^^^^^ error: cannot use `#[link_name]` with `#[link_ordinal]` - --> $DIR/link-ordinal-and-name.rs:10:5 + --> $DIR/link-ordinal-and-name.rs:8:5 | LL | #[link_ordinal(5)] | ^^^^^^^^^^^^^^^^^^ 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 index 7c8da050cf624..9b7e8d70743b7 100644 --- a/tests/ui/rfc-2627-raw-dylib/link-ordinal-invalid-format.rs +++ b/tests/ui/rfc-2627-raw-dylib/link-ordinal-invalid-format.rs @@ -1,5 +1,3 @@ -#![cfg_attr(target_arch = "x86", feature(raw_dylib))] - #[link(name = "foo")] extern "C" { #[link_ordinal("JustMonika")] 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 index 55cdcad75a4ad..6341e57a0be53 100644 --- a/tests/ui/rfc-2627-raw-dylib/link-ordinal-invalid-format.stderr +++ b/tests/ui/rfc-2627-raw-dylib/link-ordinal-invalid-format.stderr @@ -1,5 +1,5 @@ error: illegal ordinal format in `link_ordinal` - --> $DIR/link-ordinal-invalid-format.rs:5:5 + --> $DIR/link-ordinal-invalid-format.rs:3:5 | LL | #[link_ordinal("JustMonika")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -7,7 +7,7 @@ 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 + --> $DIR/link-ordinal-invalid-format.rs:6:5 | LL | #[link_ordinal("JustMonika")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 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 index 9feed39411046..6b8cd49566dfe 100644 --- a/tests/ui/rfc-2627-raw-dylib/link-ordinal-missing-argument.rs +++ b/tests/ui/rfc-2627-raw-dylib/link-ordinal-missing-argument.rs @@ -1,5 +1,3 @@ -#![cfg_attr(target_arch = "x86", feature(raw_dylib))] - #[link(name = "foo")] extern "C" { #[link_ordinal()] 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 index 853cdad8c1c54..1b04bb228e76a 100644 --- a/tests/ui/rfc-2627-raw-dylib/link-ordinal-missing-argument.stderr +++ b/tests/ui/rfc-2627-raw-dylib/link-ordinal-missing-argument.stderr @@ -1,5 +1,5 @@ error: incorrect number of arguments to `#[link_ordinal]` - --> $DIR/link-ordinal-missing-argument.rs:5:5 + --> $DIR/link-ordinal-missing-argument.rs:3:5 | LL | #[link_ordinal()] | ^^^^^^^^^^^^^^^^^ @@ -7,7 +7,7 @@ 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 + --> $DIR/link-ordinal-missing-argument.rs:6:5 | LL | #[link_ordinal()] | ^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/rfc-2627-raw-dylib/link-ordinal-multiple.rs b/tests/ui/rfc-2627-raw-dylib/link-ordinal-multiple.rs index 631c363d4ba15..8842cb944045f 100644 --- a/tests/ui/rfc-2627-raw-dylib/link-ordinal-multiple.rs +++ b/tests/ui/rfc-2627-raw-dylib/link-ordinal-multiple.rs @@ -1,6 +1,4 @@ // 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 diff --git a/tests/ui/rfc-2627-raw-dylib/link-ordinal-multiple.stderr b/tests/ui/rfc-2627-raw-dylib/link-ordinal-multiple.stderr index c0453d2bf0118..2e6cf3761c2f0 100644 --- a/tests/ui/rfc-2627-raw-dylib/link-ordinal-multiple.stderr +++ b/tests/ui/rfc-2627-raw-dylib/link-ordinal-multiple.stderr @@ -1,23 +1,23 @@ error: multiple `link_ordinal` attributes - --> $DIR/link-ordinal-multiple.rs:6:5 + --> $DIR/link-ordinal-multiple.rs:4:5 | LL | #[link_ordinal(1)] | ^^^^^^^^^^^^^^^^^^ help: remove this attribute | note: attribute also specified here - --> $DIR/link-ordinal-multiple.rs:7:5 + --> $DIR/link-ordinal-multiple.rs:5:5 | LL | #[link_ordinal(2)] | ^^^^^^^^^^^^^^^^^^ error: multiple `link_ordinal` attributes - --> $DIR/link-ordinal-multiple.rs:9:5 + --> $DIR/link-ordinal-multiple.rs:7:5 | LL | #[link_ordinal(1)] | ^^^^^^^^^^^^^^^^^^ help: remove this attribute | note: attribute also specified here - --> $DIR/link-ordinal-multiple.rs:10:5 + --> $DIR/link-ordinal-multiple.rs:8:5 | LL | #[link_ordinal(2)] | ^^^^^^^^^^^^^^^^^^ 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 index 54e614164b3a5..f33a3d62e2688 100644 --- 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 @@ -1,5 +1,3 @@ -#![cfg_attr(target_arch = "x86", feature(raw_dylib))] - #[link_ordinal(123)] //~^ ERROR attribute should be applied to a foreign function or static struct Foo {} 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 index ec4104fbe5000..8f279508720ce 100644 --- 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 @@ -1,17 +1,17 @@ error: attribute should be applied to a foreign function or static - --> $DIR/link-ordinal-not-foreign-fn.rs:3:1 + --> $DIR/link-ordinal-not-foreign-fn.rs:1: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 + --> $DIR/link-ordinal-not-foreign-fn.rs:5: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 + --> $DIR/link-ordinal-not-foreign-fn.rs:9:1 | LL | #[link_ordinal(42)] | ^^^^^^^^^^^^^^^^^^^ 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 index 46731581ebcb0..9d741630fc9da 100644 --- a/tests/ui/rfc-2627-raw-dylib/link-ordinal-too-large.rs +++ b/tests/ui/rfc-2627-raw-dylib/link-ordinal-too-large.rs @@ -1,5 +1,3 @@ -#![cfg_attr(target_arch = "x86", feature(raw_dylib))] - #[link(name = "foo")] extern "C" { #[link_ordinal(72436)] 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 index fef6de6aedfe4..811145e77ee46 100644 --- a/tests/ui/rfc-2627-raw-dylib/link-ordinal-too-large.stderr +++ b/tests/ui/rfc-2627-raw-dylib/link-ordinal-too-large.stderr @@ -1,5 +1,5 @@ error: ordinal value in `link_ordinal` is too large: `72436` - --> $DIR/link-ordinal-too-large.rs:5:5 + --> $DIR/link-ordinal-too-large.rs:3:5 | LL | #[link_ordinal(72436)] | ^^^^^^^^^^^^^^^^^^^^^^ @@ -7,7 +7,7 @@ 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 + --> $DIR/link-ordinal-too-large.rs:6:5 | LL | #[link_ordinal(72436)] | ^^^^^^^^^^^^^^^^^^^^^^ 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 index 71e0ac9f3ee4b..9988115fd8b0d 100644 --- 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 @@ -1,5 +1,3 @@ -#![cfg_attr(target_arch = "x86", feature(raw_dylib))] - #[link(name = "foo")] extern "C" { #[link_ordinal(3, 4)] 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 index 7e0fcd845cbde..d5ce8aff34f20 100644 --- 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 @@ -1,5 +1,5 @@ error: incorrect number of arguments to `#[link_ordinal]` - --> $DIR/link-ordinal-too-many-arguments.rs:5:5 + --> $DIR/link-ordinal-too-many-arguments.rs:3:5 | LL | #[link_ordinal(3, 4)] | ^^^^^^^^^^^^^^^^^^^^^ @@ -7,7 +7,7 @@ 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 + --> $DIR/link-ordinal-too-many-arguments.rs:6:5 | LL | #[link_ordinal(3, 4)] | ^^^^^^^^^^^^^^^^^^^^^ 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 index 329c93fc19637..14e915d602aaa 100644 --- 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 @@ -1,5 +1,3 @@ -#![cfg_attr(target_arch = "x86", feature(raw_dylib))] - #[link(name = "foo")] extern "C" { #[link_ordinal(3)] 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 index 5fbffbda570af..200b8f6287465 100644 --- 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 @@ -1,11 +1,11 @@ error: `#[link_ordinal]` is only supported if link kind is `raw-dylib` - --> $DIR/link-ordinal-unsupported-link-kind.rs:5:5 + --> $DIR/link-ordinal-unsupported-link-kind.rs:3: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 + --> $DIR/link-ordinal-unsupported-link-kind.rs:10:5 | LL | #[link_ordinal(3)] | ^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/rfc-2627-raw-dylib/multiple-declarations.rs b/tests/ui/rfc-2627-raw-dylib/multiple-declarations.rs index 6542faad26412..b4173f3b60bce 100644 --- a/tests/ui/rfc-2627-raw-dylib/multiple-declarations.rs +++ b/tests/ui/rfc-2627-raw-dylib/multiple-declarations.rs @@ -2,7 +2,6 @@ // 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); diff --git a/tests/ui/rfc-2627-raw-dylib/multiple-declarations.stderr b/tests/ui/rfc-2627-raw-dylib/multiple-declarations.stderr index c6808bec7b5c5..5101084054882 100644 --- a/tests/ui/rfc-2627-raw-dylib/multiple-declarations.stderr +++ b/tests/ui/rfc-2627-raw-dylib/multiple-declarations.stderr @@ -1,5 +1,5 @@ error: multiple declarations of external function `f` from library `foo.dll` have different calling conventions - --> $DIR/multiple-declarations.rs:14:9 + --> $DIR/multiple-declarations.rs:13:9 | LL | fn f(x: i32); | ^^^^^^^^^^^^^ 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 index 4efffbd532e13..d4c6658a33024 100644 --- a/tests/ui/rfc-2627-raw-dylib/raw-dylib-windows-only.rs +++ b/tests/ui/rfc-2627-raw-dylib/raw-dylib-windows-only.rs @@ -1,6 +1,5 @@ // 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 index 14e791f1fb9a1..b635a09afba4e 100644 --- a/tests/ui/rfc-2627-raw-dylib/raw-dylib-windows-only.stderr +++ b/tests/ui/rfc-2627-raw-dylib/raw-dylib-windows-only.stderr @@ -1,5 +1,5 @@ error[E0455]: link kind `raw-dylib` is only supported on Windows targets - --> $DIR/raw-dylib-windows-only.rs:4:29 + --> $DIR/raw-dylib-windows-only.rs:3:29 | LL | #[link(name = "foo", kind = "raw-dylib")] | ^^^^^^^^^^^