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

Allow casting unsized pointer types #88049

Closed
wants to merge 1 commit into from
Closed

Allow casting unsized pointer types #88049

wants to merge 1 commit into from

Conversation

dylni
Copy link
Contributor

@dylni dylni commented Aug 15, 2021

I don't think it was intentional to give these types Sized bounds.

@rust-highfive
Copy link
Collaborator

r? @joshtriplett

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Aug 15, 2021
@rust-log-analyzer
Copy link
Collaborator

The job mingw-check failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
   Compiling libc v0.2.99
   Compiling std v0.0.0 (/checkout/library/std)
   Compiling compiler_builtins v0.1.49
   Compiling unwind v0.0.0 (/checkout/library/unwind)
error[E0606]: casting `*mut T` as `*mut U` is invalid
    |
    |
387 |         unsafe { NonNull::new_unchecked(self.as_ptr() as *mut U) }
    |
    |
    = note: vtable kinds may not match

error[E0606]: casting `*mut T` as `*mut U` is invalid
   --> library/core/src/ptr/unique.rs:139:40
139 |         unsafe { Unique::new_unchecked(self.as_ptr() as *mut U) }
    |                                        ^^^^^^^^^^^^^^^^^^^^^^^
    |
    |
    = note: vtable kinds may not match

error[E0606]: casting `*const T` as `*const U` is invalid
   |
48 |         self as _
   |         ^^^^^^^^^
   |
   |
   = note: vtable kinds may not match

error[E0606]: casting `*mut T` as `*mut U` is invalid
   |
47 |         self as _
   |         ^^^^^^^^^
   |
   |
   = note: vtable kinds may not match
For more information about this error, try `rustc --explain E0606`.
error: could not compile `core` due to 4 previous errors
Build completed unsuccessfully in 0:01:12

@dylni
Copy link
Contributor Author

dylni commented Aug 15, 2021

The vtables may not match. That's unfortunate.

@dylni dylni closed this Aug 15, 2021
@dylni
Copy link
Contributor Author

dylni commented Aug 15, 2021

Related: #42847

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants