-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Labels
Description
rust-analyzer version:
using vscode ra extension, pre-release channel (also tried release, same result), version:
- Extension version: 0.4.1768
- rust-analyzer 0.3.1766-standalone (457b966 2023-12-10)
rustc version:
- rustc 1.76.0-nightly (90e321d82 2023-12-02)
relevant settings:
nothing special, toolchain install with rustup, extension installed from vscode marketplace, mostly default.
reproducing
> cargo new demo
> cd demo
> cargo add zerocopy --features derive
use zerocopy::FromZeroes;
#[repr(C)]
#[derive(Debug, Clone, Copy, FromZeroes)]
struct Header {
magic: u32,
}
problem
if I use the derive macro from zerocopy
, RA doesn't seem to pickup the impl of the derived trait.
- when I type
let header = Header::
, there's no method of the derived trait in the completion candidate lists, e.g.FromZeroes::new_zeroed()
; - if I manually type the method, no inlay type hints shows for the variable;
- when I type
header.
, the candidates list only shows keywords and snippets, no type information available; - when I hover over the variable, the popup type hint overlay shows
{unknown}
;
screenshot:
only having issue with zerocopy
not sure what's special about the zerocopy
crate, derive macros from other crates (that I have used or tested) all work fine. also, the code compiles and runs without problem.
if I expand the derive macro, it looks like this:
#[allow(deprecated)]
unsafe impl ::zerocopy::FromZeroes for Header
where
u32: ::zerocopy::FromZeroes,
{
fn only_derive_is_allowed_to_implement_this_trait() {
}
}
not knowing the inner working of RA, I would guess maybe it's the where u32: FromZeroes
clause that confuses RA?
MarinPostma