-
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 ptr::Alignment
type
#102070
Comments
Add `ptr::Alignment` type Essentially no new code here, just exposing the previously-`pub(crate)` `ValidAlign` type under the name from the ACP. ACP: rust-lang/libs-team#108 Tracking Issue: rust-lang#102070 r? `@ghost`
Add `ptr::Alignment` type Essentially no new code here, just exposing the previously-`pub(crate)` `ValidAlign` type under the name from the ACP. ACP: rust-lang/libs-team#108 Tracking Issue: rust-lang#102070 r? ``@ghost``
…thomcc From<Alignment> for usize & NonZeroUsize Since you mentioned these two in rust-lang#102072 (comment), r? `@thomcc` Tracking Issue: rust-lang#102070
…thomcc From<Alignment> for usize & NonZeroUsize Since you mentioned these two in rust-lang#102072 (comment), r? ``@thomcc`` Tracking Issue: rust-lang#102070
Remove the old `ValidAlign` name Since it looks like there won't be any reverts needed in `Layout` for rust-lang#101899 (comment), finish off this change that I'd left out of rust-lang#102072. r? `@thomcc` cc tracking issue rust-lang#102070
Remove the old `ValidAlign` name Since it looks like there won't be any reverts needed in `Layout` for rust-lang#101899 (comment), finish off this change that I'd left out of rust-lang#102072. r? ``@thomcc`` cc tracking issue rust-lang#102070
Add `ptr::Alignment` type Essentially no new code here, just exposing the previously-`pub(crate)` `ValidAlign` type under the name from the ACP. ACP: rust-lang/libs-team#108 Tracking Issue: rust-lang/rust#102070 r? ``@ghost``
From<Alignment> for usize & NonZeroUsize Since you mentioned these two in rust-lang/rust#102072 (comment), r? ``@thomcc`` Tracking Issue: rust-lang/rust#102070
I've been able to take advantage of an alignment newtype for performance in an embedded arena library and would find this useful to be stabilized. Are there any blockers for an FCP? |
We discussed this in the libs-api meeting just now. We think this type should be used in std APIs (e.g. methods of Layout) before stabilizing the type. Right now, this type doesn't seem to be used anywhere (publicly) in std, so we'd like to see a plan for usage of this type in std. We also briefly talked about the error type in the TryFrom impls. It's not immediately clear if TryFromIntError is the right type. Perhaps it needs a new error type. |
As I'm trying to make a stable version of this API as a crate for my own use, I have a few questions about the current implementation:
|
|
impl more traits for ptr::Alignment, add mask method Changes: * Adds `rustc_const_unstable` attributes where missing * Makes `log2` method const * Adds `mask` method * Implements `Default`, which is equivalent to `Alignment::MIN` No longer included in PR: * Removes indirection of `AlignmentEnum` type alias (this was intentional) * Implements `Display`, `Binary`, `Octal`, `LowerHex`, and `UpperHex` (should go through libs-api instead) * Controversially implements `LowerExp` and `UpperExp` using `p` instead of `e` to indicate a power of 2 (also should go through libs-api) Tracking issue for `ptr::Alignment`: rust-lang#102070
impl more traits for ptr::Alignment, add mask method Changes: * Adds `rustc_const_unstable` attributes where missing * Makes `log2` method const * Adds `mask` method * Implements `Default`, which is equivalent to `Alignment::MIN` No longer included in PR: * Removes indirection of `AlignmentEnum` type alias (this was intentional) * Implements `Display`, `Binary`, `Octal`, `LowerHex`, and `UpperHex` (should go through libs-api instead) * Controversially implements `LowerExp` and `UpperExp` using `p` instead of `e` to indicate a power of 2 (also should go through libs-api) Tracking issue for `ptr::Alignment`: rust-lang#102070
Feature gate:
#![feature(ptr_alignment_type)]
This is a tracking issue for the
ptr::Alignment
type, and related methods, to represent values that are valid alignments in the rust abstract machine.Public API
Steps / History
ptr::Alignment
type #102072Unresolved Questions
mask
method (from impl more traits for ptr::Alignment, add mask method #115249) correct? Should it be!(a - 1)
ora - 1
? Should it have a different name to distinguish it more from<*const _>::mask
?Footnotes
https://std-dev-guide.rust-lang.org/feature-lifecycle/stabilization.html ↩
The text was updated successfully, but these errors were encountered: