-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Align: add bytes_usize and bits_usize #124579
Conversation
#[inline] | ||
pub fn bits(self) -> u64 { | ||
self.bytes() * 8 | ||
} | ||
|
||
#[inline] | ||
pub fn bits_usize(self) -> usize { |
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.
Not sure how I feel about adding a yet unused public method but if you plan on using it soon(tm) in miri, then I'd say it's fine.
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.
FWIW I don't plan to use bits_usize (only bytes_usize), but it exists for Size and I think having a somewhat symmetric API surface here is valuable. It's not always good to remove a function just because it is not used right now, in a large codebase like ours that constantly changes.
@bors r+ rollup |
Align: add bytes_usize and bits_usize This matches `Size::bytes/bits_usize`. I recently wanted this in Miri as well.
…iaskrgr Rollup of 7 pull requests Successful merges: - rust-lang#124138 (Ignore LLVM ABI in dlltool tests since those targets don't use dlltool) - rust-lang#124414 (remove extraneous note on `UnableToRunDsymutil` diagnostic) - rust-lang#124579 (Align: add bytes_usize and bits_usize) - rust-lang#124622 (Cleanup: Rid the `rmake` test runners of `extern crate run_make_support;`) - rust-lang#124623 (shallow resolve in orphan check) - rust-lang#124624 (Use `tcx.types.unit` instead of `Ty::new_unit(tcx)`) - rust-lang#124627 (interpret: hide some reexports in rustdoc) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#124579 - RalfJung:align-bytes-usize, r=fmease Align: add bytes_usize and bits_usize This matches `Size::bytes/bits_usize`. I recently wanted this in Miri as well.
This matches
Size::bytes/bits_usize
. I recently wanted this in Miri as well.