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

silly cast errors related to undefined type names #33690

Closed
nikomatsakis opened this issue May 17, 2016 · 1 comment
Closed

silly cast errors related to undefined type names #33690

nikomatsakis opened this issue May 17, 2016 · 1 comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints C-enhancement Category: An issue proposing an enhancement or a PR with one. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@nikomatsakis
Copy link
Contributor

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;
  |>      
@nikomatsakis nikomatsakis added A-diagnostics Area: Messages for errors, warnings, and lints T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels May 17, 2016
@Mark-Simulacrum
Copy link
Member

Note: Probably quite similar if not the same as #33575.

@Mark-Simulacrum Mark-Simulacrum added the C-enhancement Category: An issue proposing an enhancement or a PR with one. label Jul 25, 2017
bors added a commit that referenced this issue Dec 25, 2017
Update check::cast::pointer_kind logic to new rustc

Make the match exhaustive, adding handling for anonymous types and
tuple coercions on the way.

Also, exit early when type errors are detected, to avoid error cascades
and the like.

Fixes #33690.
Fixes #46365.
Fixes #46880.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints C-enhancement Category: An issue proposing an enhancement or a PR with one. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

2 participants