Skip to content

silly cast errors related to undefined type names #33690

Closed
@nikomatsakis

Description

@nikomatsakis

This example:

struct Foo {
    b: Bar
}

fn main() {
    unsafe {
        let x: *const u32 = 0 as *const u32;
        let y: *const Foo = x as *const Foo;
    }
}

fn make<T>() -> T { panic!() }

gives me this error (in addition to legit errors about Bar):

error: cannot cast thin pointer `*const u32` to fat pointer `*const Foo`
 --> <anon>:8:29
8 |>         let y: *const Foo = x as *const Foo;
  |>      

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsC-enhancementCategory: An issue proposing an enhancement or a PR with one.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions