-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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 const offset_from (const_ptr_offset_from) #92980
Comments
Cc @rust-lang/wg-const-eval |
…tolnay fix const_ptr_offset_from tracking issue The old tracking issue rust-lang#41079 was for exposing those functions at all, and got closed when they were stabilized. We had nothing tracking their `const`ness so I opened a new tracking issue: rust-lang#92980.
I'd like to see if we can work out the kinks and stabilize this sooner rather than later. Since |
Note that that macro has some subtle flaws, see https://github.com/Gilnaa/memoffset for a bullet-proof (and also nightly-const-compatible) version. In particular it protects against |
But regarding this tracking issue, I think it would be good to fix rust-lang/miri#1950 before stabilizing, to ensure we actually check the UB for this function properly. (Miri and CTFE share that implementation.) Other than that, I am not aware of any blockers. I think we should do the change suggested in #92512, but that can happen post-stabilization. |
Good call on the I'll see if I can spend some time looking at the change or issue. In the meantime, I think I may have found an alternative way to calculate |
Stabilization reportI would like to propose this feature for stabilization: it allows const-code to call impl<T> *const T {
const unsafe fn offset_from(self, origin: *const T) -> isize
}
This cycle we are also on track to const-stabilize a whole lot of other pointer offset functions (#71499), so this fits quite well. The tests for this feature are at
In the future I would like to relax the UB restrictions of this function (#92512), but that should be backwards compatible so it does not have to block stabilization. @rust-lang/lang can I ask for the FCP process to be initiated? |
Or is this for @rust-lang/libs-api ? It is const-exposing an intrinsic (that could not be implemented in pure Rust), so... possibly both. |
Both teams sounds reasonable, yeah. Teams, do we want to allow offset-between-pointers calculations in Stabilization report from Ralf: #92980 (comment) @rfcbot fcp merge One correction to the report: it's rust/library/core/src/ptr/const_ptr.rs Lines 441 to 452 in 335ffbf
|
Team member @scottmcm 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. |
Good point, fixed. |
@BurntSushi @nikomatsakis @pnkfelix @yaahc friendly reminder that there are some boxes waiting for you to check them here. :) |
@rfcbot reviewed |
🔔 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. This will be merged soon. |
Any takers for a stabilization PR? :) |
turns on |
I'll prepare a stabilization PR @rustbot claim |
Stabilization has been completed [here](rust-lang#92980 (comment)) with a FCP.
…ffset_from, r=Mark-Simulacrum Stabilize `const_ptr_offset_from`. Stabilization has been completed [here](rust-lang#92980 (comment)) with a FCP. Closes rust-lang#92980.
Stabilization has been completed [here](rust-lang/rust#92980 (comment)) with a FCP.
…m, r=Mark-Simulacrum Stabilize `const_ptr_offset_from`. Stabilization has been completed [here](rust-lang/rust#92980 (comment)) with a FCP. Closes #92980.
The feature gate for the issue is
#![feature(const_ptr_offset_from)]
.This tracks
const
ness of the following function(s):About tracking issues
Tracking issues are used to record the overall progress of implementation.
They are also used as hubs connecting to other relevant issues, e.g., bugs or open design questions.
A tracking issue is however not meant for large scale discussion, questions, or bug reports about a feature.
Instead, open a dedicated issue for the specific matter and add the relevant feature gate label.
Steps
Unresolved Questions
→ this can be resolved post-stabilization since it is backwards compatible
Implementation history
The text was updated successfully, but these errors were encountered: