8000 Always inline `mem::{size_of,align_of}` in debug builds by tesuji · Pull Request #65016 · rust-lang/rust · GitHub
[go: up one dir, main page]

Skip to content

Always inline mem::{size_of,align_of} in debug builds #65016

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

Merged
merged 1 commit into from
Oct 19, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Always inline mem::{size_of,align_of} in debug builds
Those two are const fn and do not have any arguments. Inlining
helps reducing generated code size in debug builds.
  • Loading branch information
tesuji committed Oct 2, 2019
commit a87b44dbea5335c9b5d563b44e0e5f8b074ac9db
4 changes: 2 additions & 2 deletions src/libcore/mem/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ pub fn forget_unsized<T: ?Sized>(t: T) {
/// ```
///
/// [alignment]: ./fn.align_of.html
#[inline]
#[inline(always)]
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_promotable]
pub const fn size_of<T>() -> usize {
Expand Down Expand Up @@ -328,7 +328,7 @@ pub fn min_align_of_val<T: ?Sized>(val: &T) -> usize {
///
/// assert_eq!(4, mem::align_of::<i32>());
/// ```
#[inline]
#[inline(always)]
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_promotable]
pub const fn align_of<T>() -> usize {
Expand Down
0