Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 252d3da

Browse files
committedApr 22, 2017
Auto merge of #41469 - arielb1:rustc-spring-cleaning, r=eddyb
Performance audit, Spring 2017 Fix up some quite important performance "surprises" I've found running callgrind on rustc.
2 parents cb4065b + a660ad8 commit 252d3da

File tree

47 files changed

+322
-185
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+322
-185
lines changed
 

‎src/liballoc/heap.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
issue = "27700")]
1717

1818
use core::{isize, usize};
19-
#[cfg(not(test))]
2019
use core::intrinsics::{min_align_of_val, size_of_val};
2120

2221
#[allow(improper_ctypes)]
@@ -158,10 +157,9 @@ unsafe fn exchange_malloc(size: usize, align: usize) -> *mut u8 {
158157
}
159158
}
160159

161-
#[cfg(not(test))]
162-
#[lang = "box_free"]
160+
#[cfg_attr(not(test), lang = "box_free")]
163161
#[inline]
164-
unsafe fn box_free<T: ?Sized>(ptr: *mut T) {
162+
pub(crate) unsafe fn box_free<T: ?Sized>(ptr: *mut T) {
165163
let size = size_of_val(&*ptr);
166164
let align = min_align_of_val(&*ptr);
167165
// We do not allocate for Box<T> when T is ZST, so deallocation is also not necessary.

‎src/liballoc/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@
8787
#![feature(needs_allocator)]
8888
#![feature(optin_builtin_traits)]
8989
#![feature(placement_in_syntax)]
90+
#![cfg_attr(stage0, feature(pub_restricted))]
9091
#![feature(shared)]
9192
#![feature(staged_api)]
9293
#![feature(unboxed_closures)]

0 commit comments

Comments
 (0)
Please sign in to comment.