Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

False positive cast diagnostics with DSTs and zerocopy #19431

Open
ShoyuVanilla opened this issue Mar 23, 2025 · 1 comment · May be fixed by #19432
Open

False positive cast diagnostics with DSTs and zerocopy #19431

ShoyuVanilla opened this issue Mar 23, 2025 · 1 comment · May be fixed by #19432
Assignees
Labels
C-bug Category: bug

Comments

@ShoyuVanilla
Copy link
Member

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

@ShoyuVanilla ShoyuVanilla added the C-bug Category: bug label Mar 23, 2025
@ShoyuVanilla ShoyuVanilla self-assigned this Mar 23, 2025
@cloneable
Copy link

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants