Closed gipsyh closed 2 years ago
CC #6038
This works with nightly, but that has other issues (proc macros not working).
I have this problem on windows now: use std::os::windows::io::RawSocket;
was not working. However, after reading #6038, I figured adding cfg-if
in the dev-dependencies
(or regular dependencies but I don't really need that) would make it work again. Before that I though naively that rust-analyzer was not getting the right target or something and set "rust-analyzer.cargo.target": "x86_64-pc-windows-msvc"
. I went searching through the github issues after I realized the problem was something else.
I just removed those settings and the cfg-if
and the error comes back. Adding just the cfg-if
is enough to get it working again.
Also happened on nightly Rust Analyzer with rustc 1.53. Fixed by updating to rustc 1.54.
rust-analyzer.serverVersion
:
rust-analyzer version: c5ddc35a4 2021-08-14 nightly
rustc -Vv
:
rustc 1.53.0 (53cb7b09b 2021-06-17)
binary: rustc
commit-hash: 53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b
commit-date: 2021-06-17
host: x86_64-unknown-linux-gnu
release: 1.53.0
LLVM version: 12.0.1
I have been used rustc 1.54 and have the same problem, but after I updated to rustc 1.55(the latest version) and it was fixed.
This has been fixed (for some time, I guess).
when use std::os::unix::net::{UnixListener, UnixStream};
it report unresolved import
but cargo actually can compile