-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
Tracking issue for the cast
method of raw pointers
#60602
Comments
Let’s? @rfcbot fcp merge |
Team member @SimonSapin has proposed to merge this. The next step is review by the rest of the tagged team members: No concerns currently listed. Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up! See this document for info about what commands tagged team members can give me. |
🔔 This is now entering its final comment period, as per the review above. 🔔 |
The final comment period, with a disposition to merge, as per the review above, is now complete. As the automated representative of the governance process, I would like to thank the author for their work and everyone else who contributed. The RFC will be merged soon. |
Stabilize <*mut _>::cast and <*const _>::cast Fixes rust-lang#60602. FCP: rust-lang#60602 (comment)
Getting this issue when executing: More detail:
|
Your Rust installation is out of date. |
rust/download_web now fails on Fedora 39 (rustc 1.37) with: error[E0658]: use of unstable library feature 'ptr_cast' --> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/object-0.19.0/src/pod.rs:35:30 | 35 | let val = unsafe { &*ptr.cast() }; | ^^^^ | = note: for more information, see rust-lang/rust#60602 error[E0658]: use of unstable library feature 'ptr_cast' --> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/object-0.19.0/src/pod.rs:53:52 | 53 | let slice = unsafe { slice::from_raw_parts(ptr.cast(), count) }; | ^^^^ | = note: for more information, see rust-lang/rust#60602 error[E0658]: use of unstable library feature 'ptr_cast' --> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/object-0.19.0/src/pod.rs:65:66 | 65 | unsafe { slice::from_raw_parts(slice::from_ref(val).as_ptr().cast(), size) } | ^^^^ | = note: for more information, see rust-lang/rust#60602 This feature is https://doc.bccnsoft.com/docs/rust-1.36.0-docs-html/unstable-book/library-features/ptr-cast.html, stabilized in rust-lang/rust#62713 merged in Rust 1.38 (2019-09-26).
Required by the transitive dev-dependency (via rayon) on crossbeam-utils. error[E0277]: the trait bound `atomic::seq_lock::SeqLock: std::marker::Copy` is not satisfied --> github.com-1ecc6299db9ec823/crossbeam-utils-0.8.11/src/atomic/atomic_cell.rs:905:36 | 905 | static LOCKS: [SeqLock; LEN] = [L; LEN]; | ^^^^^^^^ the trait `std::marker::Copy` is not implemented for `atomic::seq_lock::SeqLock` | = note: the `Copy` trait is required because the repeated element will be copied error[E0658]: use of unstable library feature 'ptr_cast' --> github.com-1ecc6299db9ec823/crossbeam-utils-0.8.11/src/atomic/atomic_cell.rs:183:26 | 183 | self.value.get().cast::<T>() | ^^^^ | = note: for more information, see rust-lang/rust#60602 error[E0658]: use of unstable library feature 'ptr_cast' --> github.com-1ecc6299db9ec823/crossbeam-utils-0.8.11/src/atomic/atomic_cell.rs:1008:50 | 1008 | let val = ptr::read_volatile(src.cast::<MaybeUninit<T>>()); | ^^^^ | = note: for more information, see rust-lang/rust#60602 error[E0658]: use of unstable library feature 'ptr_cast' --> github.com-1ecc6299db9ec823/crossbeam-utils-0.8.11/src/sync/parker.rs:267:35 | 267 | Arc::into_raw(this.inner).cast::<()>() | ^^^^ | = note: for more information, see rust-lang/rust#60602 error[E0658]: use of unstable library feature 'ptr_cast' --> github.com-1ecc6299db9ec823/crossbeam-utils-0.8.11/src/sync/parker.rs:289:38 | 289 | inner: Arc::from_raw(ptr.cast::<Inner>()), | ^^^^ | = note: for more information, see rust-lang/rust#60602
#60601 adds:
Like with
NonNull::cast
, the input pointed type does not need to beSized
but the output pointed type does, because we wouldn’t know what appropriate pointer metadata (slice length, trait object vtable, …) to insert. The actual requirement is that the pointer is thin, butSized
is the closest approximation we have (until we add something likeT: ptr::Pointee<Metadata=()>
).The text was updated successfully, but these errors were encountered: