-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Labels
A-macromacro expansionmacro expansionA-tytype system / type inference / traits / method resolutiontype system / type inference / traits / method resolutionC-bugCategory: bugCategory: bugS-actionableSomeone could pick this issue up and work on it right nowSomeone could pick this issue up and work on it right now
Description
This code reports an incorrect "expected MemoryUsage
, found ()
" type mismatch error:
rust-analyzer/crates/profile/src/memory_usage.rs
Lines 28 to 55 in 0fe3bcf
cfg_if! { | |
if #[cfg(all(feature = "jemalloc", not(target_env = "msvc")))] { | |
jemalloc_ctl::epoch::advance().unwrap(); | |
MemoryUsage { | |
allocated: Bytes(jemalloc_ctl::stats::allocated::read().unwrap() as isize), | |
} | |
} else if #[cfg(all(target_os = "linux", target_env = "gnu"))] { | |
memusage_linux() | |
} else if #[cfg(windows)] { | |
// There doesn't seem to be an API for determining heap usage, so we try to | |
// approximate that by using the Commit Charge value. | |
use winapi::um::processthreadsapi::*; | |
use winapi::um::psapi::*; | |
use std::mem::{MaybeUninit, size_of}; | |
let proc = unsafe { GetCurrentProcess() }; | |
let mut mem_counters = MaybeUninit::uninit(); | |
let cb = size_of::<PROCESS_MEMORY_COUNTERS>(); | |
let ret = unsafe { GetProcessMemoryInfo(proc, mem_counters.as_mut_ptr(), cb as u32) }; | |
assert!(ret != 0); | |
let usage = unsafe { mem_counters.assume_init().PagefileUsage }; | |
MemoryUsage { allocated: Bytes(usage as isize) } | |
} else { | |
MemoryUsage { allocated: Bytes(0) } | |
} | |
} |
Might be due to incorrect handling of macros in block tail position.
Metadata
Metadata
Assignees
Labels
A-macromacro expansionmacro expansionA-tytype system / type inference / traits / method resolutiontype system / type inference / traits / method resolutionC-bugCategory: bugCategory: bugS-actionableSomeone could pick this issue up and work on it right nowSomeone could pick this issue up and work on it right now