mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-14 06:03:58 +00:00
Auto merge of #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: https://github.com/rust-lang/rust/pull/124578
This commit is contained in:
commit
cfce2bb46d
7 changed files with 9 additions and 10 deletions
6
Cargo.lock
generated
6
Cargo.lock
generated
|
@ -1402,7 +1402,7 @@ dependencies = [
|
||||||
"perf-event",
|
"perf-event",
|
||||||
"tikv-jemalloc-ctl",
|
"tikv-jemalloc-ctl",
|
||||||
"tracing",
|
"tracing",
|
||||||
"winapi",
|
"windows-sys 0.52.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -1682,7 +1682,7 @@ dependencies = [
|
||||||
"vfs",
|
"vfs",
|
||||||
"vfs-notify",
|
"vfs-notify",
|
||||||
"walkdir",
|
"walkdir",
|
||||||
"winapi",
|
"windows-sys 0.52.0",
|
||||||
"xflags",
|
"xflags",
|
||||||
"xshell",
|
"xshell",
|
||||||
]
|
]
|
||||||
|
@ -1904,7 +1904,7 @@ dependencies = [
|
||||||
"jod-thread",
|
"jod-thread",
|
||||||
"libc",
|
"libc",
|
||||||
"miow",
|
"miow",
|
||||||
"winapi",
|
"windows-sys 0.52.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
|
|
@ -24,7 +24,7 @@ jemalloc-ctl = { version = "0.5.0", package = "tikv-jemalloc-ctl", optional = tr
|
||||||
perf-event = "=0.4.7"
|
perf-event = "=0.4.7"
|
||||||
|
|
||||||
[target.'cfg(windows)'.dependencies]
|
[target.'cfg(windows)'.dependencies]
|
||||||
winapi = { version = "0.3.9", features = ["processthreadsapi", "psapi"] }
|
windows-sys = { version = "0.52", features = ["Win32_System_Threading", "Win32_System_ProcessStatus"] }
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
cpu_profiler = []
|
cpu_profiler = []
|
||||||
|
|
|
@ -37,8 +37,7 @@ impl MemoryUsage {
|
||||||
// There doesn't seem to be an API for determining heap usage, so we try to
|
// There doesn't seem to be an API for determining heap usage, so we try to
|
||||||
// approximate that by using the Commit Charge value.
|
// approximate that by using the Commit Charge value.
|
||||||
|
|
||||||
use winapi::um::processthreadsapi::*;
|
use windows_sys::Win32::System::{Threading::*, ProcessStatus::*};
|
||||||
use winapi::um::psapi::*;
|
|
||||||
use std::mem::{MaybeUninit, size_of};
|
use std::mem::{MaybeUninit, size_of};
|
||||||
|
|
||||||
let proc = unsafe { GetCurrentProcess() };
|
let proc = unsafe { GetCurrentProcess() };
|
||||||
|
|
|
@ -69,7 +69,7 @@ vfs.workspace = true
|
||||||
paths.workspace = true
|
paths.workspace = true
|
||||||
|
|
||||||
[target.'cfg(windows)'.dependencies]
|
[target.'cfg(windows)'.dependencies]
|
||||||
winapi = "0.3.9"
|
windows-sys = { version = "0.52", features = ["Win32_System_Threading"] }
|
||||||
|
|
||||||
[target.'cfg(not(target_env = "msvc"))'.dependencies]
|
[target.'cfg(not(target_env = "msvc"))'.dependencies]
|
||||||
jemallocator = { version = "0.5.0", package = "tikv-jemallocator", optional = true }
|
jemallocator = { version = "0.5.0", package = "tikv-jemallocator", optional = true }
|
||||||
|
|
|
@ -45,7 +45,7 @@ pub fn main_loop(config: Config, connection: Connection) -> anyhow::Result<()> {
|
||||||
// https://github.com/rust-lang/rust-analyzer/issues/2835
|
// https://github.com/rust-lang/rust-analyzer/issues/2835
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
unsafe {
|
unsafe {
|
||||||
use winapi::um::processthreadsapi::*;
|
use windows_sys::Win32::System::Threading::*;
|
||||||
let thread = GetCurrentThread();
|
let thread = GetCurrentThread();
|
||||||
let thread_priority_above_normal = 1;
|
let thread_priority_above_normal = 1;
|
||||||
SetThreadPriority(thread, thread_priority_above_normal);
|
SetThreadPriority(thread, thread_priority_above_normal);
|
||||||
|
|
|
@ -22,7 +22,7 @@ itertools.workspace = true
|
||||||
|
|
||||||
[target.'cfg(windows)'.dependencies]
|
[target.'cfg(windows)'.dependencies]
|
||||||
miow = "0.6.0"
|
miow = "0.6.0"
|
||||||
winapi = { version = "0.3.9", features = ["winerror"] }
|
windows-sys = { version = "0.52", features = ["Win32_Foundation"] }
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
# Uncomment to enable for the whole crate graph
|
# Uncomment to enable for the whole crate graph
|
||||||
|
|
|
@ -162,7 +162,7 @@ mod imp {
|
||||||
pipe::NamedPipe,
|
pipe::NamedPipe,
|
||||||
Overlapped,
|
Overlapped,
|
||||||
};
|
};
|
||||||
use winapi::shared::winerror::ERROR_BROKEN_PIPE;
|
use windows_sys::Win32::Foundation::ERROR_BROKEN_PIPE;
|
||||||
|
|
||||||
struct Pipe<'a> {
|
struct Pipe<'a> {
|
||||||
dst: &'a mut Vec<u8>,
|
dst: &'a mut Vec<u8>,
|
||||||
|
|
Loading…
Reference in a new issue