Skip to content

Commit 9ce7ab6

Browse files
committed
Auto merge of rust-lang#17168 - kennykerr:rust-analyzer-windows-sys, r=lnicola
Update `rust-analyzer` to use `windows-sys` crate I noticed that the `rust-analyzer` project already depends on `windows-sys`. This update merely replaces the remaining direct dependencies on the older `winapi` crate with `windows-sys` dependencies. Originally posted here: rust-lang#124578
2 parents d70c876 + 60cac54 commit 9ce7ab6

File tree

7 files changed

+9
-10
lines changed

7 files changed

+9
-10
lines changed

src/tools/rust-analyzer/Cargo.lock

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/tools/rust-analyzer/crates/profile/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jemalloc-ctl = { version = "0.5.0", package = "tikv-jemalloc-ctl", optional = tr
2424
perf-event = "=0.4.7"
2525

2626
[target.'cfg(windows)'.dependencies]
27-
winapi = { version = "0.3.9", features = ["processthreadsapi", "psapi"] }
27+
windows-sys = { version = "0.52", features = ["Win32_System_Threading", "Win32_System_ProcessStatus"] }
2828

2929
[features]
3030
cpu_profiler = []

src/tools/rust-analyzer/crates/profile/src/memory_usage.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,7 @@ impl MemoryUsage {
3737
// There doesn't seem to be an API for determining heap usage, so we try to
3838
// approximate that by using the Commit Charge value.
3939

40-
use winapi::um::processthreadsapi::*;
41-
use winapi::um::psapi::*;
40+
use windows_sys::Win32::System::{Threading::*, ProcessStatus::*};
4241
use std::mem::{MaybeUninit, size_of};
4342

4443
let proc = unsafe { GetCurrentProcess() };

src/tools/rust-analyzer/crates/rust-analyzer/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ vfs.workspace = true
6969
paths.workspace = true
7070

7171
[target.'cfg(windows)'.dependencies]
72-
winapi = "0.3.9"
72+
windows-sys = { version = "0.52", features = ["Win32_System_Threading"] }
7373

7474
[target.'cfg(not(target_env = "msvc"))'.dependencies]
7575
jemallocator = { version = "0.5.0", package = "tikv-jemallocator", optional = true }

src/tools/rust-analyzer/crates/rust-analyzer/src/main_loop.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ pub fn main_loop(config: Config, connection: Connection) -> anyhow::Result<()> {
4545
// https://github.com/rust-lang/rust-analyzer/issues/2835
4646
#[cfg(windows)]
4747
unsafe {
48-
use winapi::um::processthreadsapi::*;
48+
use windows_sys::Win32::System::Threading::*;
4949
let thread = GetCurrentThread();
5050
let thread_priority_above_normal = 1;
5151
SetThreadPriority(thread, thread_priority_above_normal);

src/tools/rust-analyzer/crates/stdx/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ itertools.workspace = true
2222

2323
[target.'cfg(windows)'.dependencies]
2424
miow = "0.6.0"
25-
winapi = { version = "0.3.9", features = ["winerror"] }
25+
windows-sys = { version = "0.52", features = ["Win32_Foundation"] }
2626

2727
[features]
2828
# Uncomment to enable for the whole crate graph

src/tools/rust-analyzer/crates/stdx/src/process.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ mod imp {
162162
pipe::NamedPipe,
163163
Overlapped,
164164
};
165-
use winapi::shared::winerror::ERROR_BROKEN_PIPE;
165+
use windows_sys::Win32::Foundation::ERROR_BROKEN_PIPE;
166166

167167
struct Pipe<'a> {
168168
dst: &'a mut Vec<u8>,

0 commit comments

Comments
 (0)