-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Make various trait impls/methods const
for the Alignment
and NonZero
* structs.
#110346
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @joshtriplett (or someone else) soon. Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (
|
Hey! It looks like you've submitted a new PR for the library teams! If this PR contains changes to any Examples of
|
library/core/src/ptr/alignment.rs
Outdated
@@ -18,7 +18,8 @@ pub struct Alignment(AlignmentEnum); | |||
const _: () = assert!(mem::size_of::<Alignment>() == mem::size_of::<usize>()); | |||
const _: () = assert!(mem::align_of::<Alignment>() == mem::align_of::<usize>()); | |||
|
|||
fn _alignment_can_be_structurally_matched(a: Alignment) -> bool { | |||
#[inline] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why #[inline]
? Does this function even get called anywhere?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did a quick search and it doesn't seem to be used, so i have removed it for now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't remove the entire function. It tests that Alignment
can be structurally match
ed, and if it can't, a compiler error is raised.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i did not realize that, i have added it back.
the `Alignment` and `NonZero`* structs.
Thanks for the PR, but I don't think we are accepting new PRs adding new |
Alright, i will close this PR. |
It can be reopened once #110395 is carried out. |
Make a few more methods and trait implementations
const
for theAlignment
struct, as well as theNonZero
* types.