diff options
| author | bors <bors@rust-lang.org> | 2023-05-06 00:34:37 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-05-06 00:34:37 +0000 |
| commit | 6d140d59bb957903b02ddb993450509d8d92b448 (patch) | |
| tree | 2e74d588be207d6ee188e6182e851fc1dc660d07 /src | |
| parent | 963e5c0eff171160238dc2a2c0ba7a1912fada67 (diff) | |
| parent | 393e285e14fcc8477d74ed3919460e7a53d2fbe1 (diff) | |
| download | rust-6d140d59bb957903b02ddb993450509d8d92b448.tar.gz rust-6d140d59bb957903b02ddb993450509d8d92b448.zip | |
Auto merge of #111271 - JohnTitor:rollup-t07qk1c, r=JohnTitor
Rollup of 8 pull requests Successful merges: - #109677 (Stabilize raw-dylib, link_ordinal, import_name_type and -Cdlltool) - #110780 (rustdoc-search: add slices and arrays to index) - #110830 (Add FreeBSD cpuset support to `std::thread::available_concurrency`) - #111139 (Fix MXCSR configuration dependent timing) - #111239 (Remove unnecessary attribute from a diagnostic) - #111246 (forbid escaping bound vars in combine) - #111251 (Issue 109502 follow up, remove unnecessary Vec::new() from compile_test()) - #111261 (Mark `ErrorGuaranteed` constructor as deprecated so people don't use it) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'src')
| -rw-r--r-- | src/doc/rustc/src/codegen-options/index.md | 8 | ||||
| -rw-r--r-- | src/doc/unstable-book/src/language-features/raw-dylib.md | 34 | ||||
| -rw-r--r-- | src/librustdoc/html/render/search_index.rs | 30 | ||||
| -rw-r--r-- | src/librustdoc/lib.rs | 7 | ||||
| -rw-r--r-- | src/tools/compiletest/src/header/needs.rs | 36 | ||||
| -rw-r--r-- | src/tools/compiletest/src/runtest.rs | 34 |
6 files changed, 94 insertions, 55 deletions
diff --git a/src/doc/rustc/src/codegen-options/index.md b/src/doc/rustc/src/codegen-options/index.md index e2b859e705d..1041d502669 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 5fd208ae757..00000000000 --- 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/librustdoc/html/render/search_index.rs b/src/librustdoc/html/render/search_index.rs index f5b4a3f5abd..a3be6dd5269 100644 --- a/src/librustdoc/html/render/search_index.rs +++ b/src/librustdoc/html/render/search_index.rs @@ -391,12 +391,14 @@ fn get_index_type_id(clean_type: &clean::Type) -> Option<RenderTypeId> { clean::BorrowedRef { ref type_, .. } | clean::RawPointer(_, ref type_) => { get_index_type_id(type_) } + // The type parameters are converted to generics in `add_generics_and_bounds_as_types` + clean::Slice(_) => Some(RenderTypeId::Primitive(clean::PrimitiveType::Slice)), + clean::Array(_, _) => Some(RenderTypeId::Primitive(clean::PrimitiveType::Array)), + // Not supported yet clean::BareFunction(_) | clean::Generic(_) | clean::ImplTrait(_) | clean::Tuple(_) - | clean::Slice(_) - | clean::Array(_, _) | clean::QPath { .. } | clean::Infer => None, } @@ -563,6 +565,30 @@ fn add_generics_and_bounds_as_types<'tcx, 'a>( } } insert_ty(res, arg.clone(), ty_generics); + } else if let Type::Slice(ref ty) = *arg { + let mut ty_generics = Vec::new(); + add_generics_and_bounds_as_types( + self_, + generics, + &ty, + tcx, + recurse + 1, + &mut ty_generics, + cache, + ); + insert_ty(res, arg.clone(), ty_generics); + } else if let Type::Array(ref ty, _) = *arg { + let mut ty_generics = Vec::new(); + add_generics_and_bounds_as_types( + self_, + generics, + &ty, + tcx, + recurse + 1, + &mut ty_generics, + cache, + ); + insert_ty(res, arg.clone(), ty_generics); } else { // This is not a type parameter. So for example if we have `T, U: Option<T>`, and we're // looking at `Option`, we enter this "else" condition, otherwise if it's `T`, we don't. diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs index 263ce3d93b9..1d4892bcb2a 100644 --- a/src/librustdoc/lib.rs +++ b/src/librustdoc/lib.rs @@ -172,7 +172,11 @@ pub fn main() { let exit_code = rustc_driver::catch_with_exit_code(|| match get_args() { Some(args) => main_args(&args), - _ => Err(ErrorGuaranteed::unchecked_claim_error_was_emitted()), + _ => + { + #[allow(deprecated)] + Err(ErrorGuaranteed::unchecked_claim_error_was_emitted()) + } }); process::exit(exit_code); } @@ -725,6 +729,7 @@ fn main_args(at_args: &[String]) -> MainResult { return if code == 0 { Ok(()) } else { + #[allow(deprecated)] Err(ErrorGuaranteed::unchecked_claim_error_was_emitted()) }; } diff --git a/src/tools/compiletest/src/header/needs.rs b/src/tools/compiletest/src/header/needs.rs index 81179480ed8..4a57c61406c 100644 --- a/src/tools/compiletest/src/header/needs.rs +++ b/src/tools/compiletest/src/header/needs.rs @@ -116,6 +116,11 @@ pub(super) fn handle_needs( 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, ignore_reason: "ignored when git hashes have been omitted for building", @@ -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::<Vec<_>>(); + // 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/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index 841f5b4f6ee..4ede4603789 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -319,8 +319,7 @@ impl<'test> TestCx<'test> { fn run_cfail_test(&self) { let pm = self.pass_mode(); - let proc_res = - self.compile_test(WillExecute::No, self.should_emit_metadata(pm), Vec::new()); + let proc_res = self.compile_test(WillExecute::No, self.should_emit_metadata(pm)); self.check_if_test_should_compile(&proc_res, pm); self.check_no_compiler_crash(&proc_res, self.props.should_ice); @@ -348,7 +347,7 @@ impl<'test> TestCx<'test> { fn run_rfail_test(&self) { let pm = self.pass_mode(); let should_run = self.run_if_enabled(); - let proc_res = self.compile_test(should_run, self.should_emit_metadata(pm), Vec::new()); + let proc_res = self.compile_test(should_run, self.should_emit_metadata(pm)); if !proc_res.status.success() { self.fatal_proc_rec("compilation failed!", &proc_res); @@ -396,7 +395,7 @@ impl<'test> TestCx<'test> { fn run_cpass_test(&self) { let emit_metadata = self.should_emit_metadata(self.pass_mode()); - let proc_res = self.compile_test(WillExecute::No, emit_metadata, Vec::new()); + let proc_res = self.compile_test(WillExecute::No, emit_metadata); if !proc_res.status.success() { self.fatal_proc_rec("compilation failed!", &proc_res); @@ -411,7 +410,7 @@ impl<'test> TestCx<'test> { fn run_rpass_test(&self) { let emit_metadata = self.should_emit_metadata(self.pass_mode()); let should_run = self.run_if_enabled(); - let proc_res = self.compile_test(should_run, emit_metadata, Vec::new()); + let proc_res = self.compile_test(should_run, emit_metadata); if !proc_res.status.success() { self.fatal_proc_rec("compilation failed!", &proc_res); @@ -441,7 +440,7 @@ impl<'test> TestCx<'test> { } let should_run = self.run_if_enabled(); - let mut proc_res = self.compile_test(should_run, Emit::None, Vec::new()); + let mut proc_res = self.compile_test(should_run, Emit::None); if !proc_res.status.success() { self.fatal_proc_rec("compilation failed!", &proc_res); @@ -687,7 +686,7 @@ impl<'test> TestCx<'test> { // compile test file (it should have 'compile-flags:-g' in the header) let should_run = self.run_if_enabled(); - let compile_result = self.compile_test(should_run, Emit::None, Vec::new()); + let compile_result = self.compile_test(should_run, Emit::None); if !compile_result.status.success() { self.fatal_proc_rec("compilation failed!", &compile_result); } @@ -807,7 +806,7 @@ impl<'test> TestCx<'test> { // compile test file (it should have 'compile-flags:-g' in the header) let should_run = self.run_if_enabled(); - let compiler_run_result = self.compile_test(should_run, Emit::None, Vec::new()); + let compiler_run_result = self.compile_test(should_run, Emit::None); if !compiler_run_result.status.success() { self.fatal_proc_rec("compilation failed!", &compiler_run_result); } @@ -1044,7 +1043,7 @@ impl<'test> TestCx<'test> { fn run_debuginfo_lldb_test_no_opt(&self) { // compile test file (it should have 'compile-flags:-g' in the header) let should_run = self.run_if_enabled(); - let compile_result = self.compile_test(should_run, Emit::None, Vec::new()); + let compile_result = self.compile_test(should_run, Emit::None); if !compile_result.status.success() { self.fatal_proc_rec("compilation failed!", &compile_result); } @@ -1483,7 +1482,16 @@ impl<'test> TestCx<'test> { } } - fn compile_test(&self, will_execute: WillExecute, emit: Emit, passes: Vec<String>) -> ProcRes { + fn compile_test(&self, will_execute: WillExecute, emit: Emit) -> ProcRes { + self.compile_test_general(will_execute, emit, self.props.local_pass_mode(), Vec::new()) + } + + fn compile_test_with_passes( + &self, + will_execute: WillExecute, + emit: Emit, + passes: Vec<String>, + ) -> ProcRes { self.compile_test_general(will_execute, emit, self.props.local_pass_mode(), passes) } @@ -2791,7 +2799,7 @@ impl<'test> TestCx<'test> { fn run_codegen_units_test(&self) { assert!(self.revision.is_none(), "revisions not relevant here"); - let proc_res = self.compile_test(WillExecute::No, Emit::None, Vec::new()); + let proc_res = self.compile_test(WillExecute::No, Emit::None); if !proc_res.status.success() { self.fatal_proc_rec("compilation failed!", &proc_res); @@ -3340,7 +3348,7 @@ impl<'test> TestCx<'test> { let pm = self.pass_mode(); let should_run = self.should_run(pm); let emit_metadata = self.should_emit_metadata(pm); - let proc_res = self.compile_test(should_run, emit_metadata, Vec::new()); + let proc_res = self.compile_test(should_run, emit_metadata); self.check_if_test_should_compile(&proc_res, pm); // if the user specified a format in the ui test @@ -3523,7 +3531,7 @@ impl<'test> TestCx<'test> { let emit_metadata = self.should_emit_metadata(pm); let passes = self.get_passes(); - let proc_res = self.compile_test(should_run, emit_metadata, passes); + let proc_res = self.compile_test_with_passes(should_run, emit_metadata, passes); self.check_mir_dump(); if !proc_res.status.success() { self.fatal_proc_rec("compilation failed!", &proc_res); |
