-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Open
Labels
C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCCategory: An issue tracking the progress of sth. like the implementation of an RFCT-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.
Description
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
// core::ptr
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Alignment(…);
impl Debug for Alignment;
impl Ord for Alignment;
impl PartialOrd for Alignment;
impl Hash for Alignment;
impl Alignment {
pub const MIN: Self;
pub const fn of<T>() -> Self;
pub const fn new(align: usize) -> Option<Self>;
pub const unsafe fn new_unchecked(align: usize) -> Self;
pub const fn as_usize(self) -> usize;
pub const fn as_nonzero(self) -> NonZeroUsize;
pub const fn log2(self) -> u32;
}
impl TryFrom<NonZeroUsize> for Alignment;
impl TryFrom<usize> for Alignment;
impl From<Alignment> for NonZeroUsize;
impl From<Alignment> for usize;
Steps / History
- To pick up a draggable item, press the space bar. While dragging, use the arrow keys to move the item. Press space again to drop the item in its new position, or press escape to cancel.
Unresolved Questions
- Is the
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
?To pick up a draggable item, press the space bar. While dragging, use the arrow keys to move the item. Press space again to drop the item in its new position, or press escape to cancel.
Footnotes
orzogc and DevilishSpiritsjoseluis
Metadata
Metadata
Assignees
Labels
C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCCategory: An issue tracking the progress of sth. like the implementation of an RFCT-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.
Type
Projects
Milestone
Relationships
Development
Select code repository
Activity
ptr::Alignment
type #102072Rollup merge of rust-lang#102072 - scottmcm:ptr-alignment-type, r=thomcc
Rollup merge of rust-lang#102072 - scottmcm:ptr-alignment-type, r=thomcc
Rollup merge of rust-lang#102862 - scottmcm:more-alignment-traits, r=…
Rollup merge of rust-lang#102862 - scottmcm:more-alignment-traits, r=…
ValidAlign
name #104308Rollup merge of rust-lang#104308 - scottmcm:no-more-validalign, r=thomcc
Rollup merge of rust-lang#104308 - scottmcm:no-more-validalign, r=thomcc
Rollup merge of #102072 - scottmcm:ptr-alignment-type, r=thomcc
Rollup merge of #102862 - scottmcm:more-alignment-traits, r=thomcc
kupiakos commentedon Jul 22, 2023
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?
15 remaining items