Skip to content

False positive cast diagnostics with DSTs and zerocopy #19431

Closed
@ShoyuVanilla

Description

@ShoyuVanilla

There's still a problem with KnownLayout when the DST is wrapped:

use zerocopy::KnownLayout;

#[derive(KnownLayout)]
#[repr(C)]
pub struct Dst([u8]);

#[derive(KnownLayout)]
#[repr(C)]
pub struct Struct {
    pub dst: Dst,
}
cannot cast thin pointer `*mut __ZerocopyKnownLayoutMaybeUninit` to fat pointer `*mut _` rust-analyzer[E0607]

rust-analyzer 1.85.1 (4eb16125 2025-03-15)

No problem with rustc.

Originally posted by @cloneable in #18682

Metadata

Metadata

Assignees

Labels

C-bugCategory: bug

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions