Skip to content

Commit 5c4aadf

Browse files
committed
Working?!
1 parent 553f5be commit 5c4aadf

File tree

6 files changed

+16
-10
lines changed

6 files changed

+16
-10
lines changed

src/Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/liballoc_frame/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
#![feature(const_fn)]
2222
#![feature(staged_api)]
2323
#![feature(libc)]
24-
#![cfg_attr(any(unix, target_os = "redox"), feature(libc))]
2524

2625
extern crate libc;
2726

@@ -104,7 +103,8 @@ pub extern "C" fn __rust_usable_size(size: usize, _align: usize) -> usize {
104103

105104
#[cfg(any(unix, target_os = "redox"))]
106105
mod imp {
107-
use core::cmp;
106+
use libc;
107+
use core::ptr;
108108
use MIN_ALIGN;
109109

110110
pub unsafe fn allocate(size: usize, align: usize) -> *mut u8 {

src/librustc_metadata/creader.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -771,14 +771,17 @@ impl<'a> CrateLoader<'a> {
771771
// also bail out as we don't need to implicitly inject one.
772772
let mut needs_allocator = false;
773773
let mut found_required_allocator = false;
774+
println!("injecting allocator for {}", self.local_crate_name);
774775
self.cstore.iter_crate_data(|cnum, data| {
775776
needs_allocator = needs_allocator || data.needs_allocator();
776777
if data.is_allocator() {
777-
info!("{} required by rlib and is an allocator", data.name());
778+
println!("{} required by rlib and is an allocator", data.name());
778779
self.inject_dependency_if(cnum, "an allocator",
779780
&|data| data.needs_allocator());
780-
found_required_allocator = found_required_allocator ||
781-
data.dep_kind.get() == DepKind::Explicit;
781+
let explicit_dep = data.dep_kind.get() == DepKind::Explicit;
782+
println!("{} {} an explicit dependency", data.name(),
783+
if explicit_dep {"is"} else {"is not"});
784+
found_required_allocator = found_required_allocator || explicit_dep;
782785
}
783786
});
784787
if !needs_allocator || found_required_allocator { return }
@@ -820,14 +823,15 @@ impl<'a> CrateLoader<'a> {
820823
// * Binaries use jemalloc
821824
// * Staticlibs and Rust dylibs use system malloc
822825
// * Rust dylibs used as dependencies to rust use jemalloc
823-
let name = if cfg!(rustc_alloc_frame) && (cfg!(stage0) || cfg!(stage1)) {
826+
let name = if cfg!(feature = "rustc_alloc_frame") && cfg!(stage0) {
824827
// HACK to make stage1/2 with alloc_frame
825828
Symbol::intern(&"alloc_frame")
826829
} else if need_lib_alloc && !self.sess.opts.cg.prefer_dynamic {
827830
Symbol::intern(&self.sess.target.target.options.lib_allocation_crate)
828831
} else {
829832
Symbol::intern(&self.sess.target.target.options.exe_allocation_crate)
830833
};
834+
println!("Injecting {} for {}", name, self.local_crate_name);
831835
let dep_kind = DepKind::Implicit;
832836
let (cnum, data) =
833837
self.resolve_crate(&None, name, name, None, DUMMY_SP, PathKind::Crate, dep_kind);

src/libstd/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ crate-type = ["dylib", "rlib"]
1313
alloc = { path = "../liballoc" }
1414
alloc_jemalloc = { path = "../liballoc_jemalloc", optional = true }
1515
alloc_system = { path = "../liballoc_system" }
16+
alloc_frame = { path = "../liballoc_frame" }
1617
panic_unwind = { path = "../libpanic_unwind", optional = true }
1718
panic_abort = { path = "../libpanic_abort" }
1819
collections = { path = "../libcollections" }

src/rustc/rustc.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@
1010

1111
#![feature(rustc_private)]
1212
#![feature(staged_api)]
13-
#![cfg_attr(all(feature = "rustc_alloc_frame", not(stage0)), feature(alloc_frame))]
13+
#![cfg_attr(all(feature = "rustc_alloc_frame", stage1), feature(alloc_frame))]
1414

1515
extern crate rustc_driver;
1616

1717
// Use the frame allocator to speed up runtime
18-
#[cfg(all(feature = "rustc_alloc_frame", not(stage0)))]
18+
#[cfg(all(feature = "rustc_alloc_frame", stage1))]
1919
extern crate alloc_frame;
2020

2121
fn main() { rustc_driver::main() }

src/rustc/rustdoc.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@
1010

1111
#![feature(rustdoc)]
1212
#![feature(staged_api)]
13-
#![cfg_attr(all(feature = "rustc_alloc_frame", not(stage0)), feature(alloc_frame))]
13+
#![cfg_attr(all(feature = "rustc_alloc_frame", stage1), feature(alloc_frame))]
1414

1515
extern crate rustdoc;
1616

1717
// Use the frame allocator to speed up runtime
18-
#[cfg(all(feature = "rustc_alloc_frame", not(stage0)))]
18+
#[cfg(all(feature = "rustc_alloc_frame", stage1))]
1919
extern crate alloc_frame;
2020

2121
fn main() { rustdoc::main() }

0 commit comments

Comments
 (0)