Skip to content

Commit 8fded29

Browse files
author
Alexander Light
committed
Made external_crates feature work again.
Also added test for it. Fixes #21928
1 parent ac134f7 commit 8fded29

File tree

3 files changed

+44
-1
lines changed

3 files changed

+44
-1
lines changed

src/liballoc/lib.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,9 @@
7373
#![feature(unboxed_closures)]
7474
#![feature(core)]
7575
#![feature(hash)]
76-
#![feature(libc)]
76+
#![cfg_attr(all(not(feature = "external_funcs"), not(feature = "external_crate")),
77+
feature(libc))]
78+
7779

7880
#[macro_use]
7981
extern crate core;
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
-include ../tools.mk
2+
3+
all:
4+
$(RUSTC) fakealloc.rs
5+
$(RUSTC) ../../../liballoc/lib.rs --cfg feature=\"external_crate\" --extern external=$(TMPDIR)/$(shell $(RUSTC) --print file-names fakealloc.rs)
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
#![crate_type = "rlib"]
12+
#![no_std]
13+
#![feature(core)]
14+
extern crate core;
15+
16+
17+
#[inline]
18+
pub unsafe fn allocate(_size: usize, _align: usize) -> *mut u8 { 0 as *mut u8 }
19+
20+
#[inline]
21+
pub unsafe fn deallocate(_ptr: *mut u8, _old_size: usize, _align: usize) { }
22+
23+
#[inline]
24+
pub unsafe fn reallocate(_ptr: *mut u8, _old_size: usize, _size: usize, _align: usize) -> *mut u8 {
25+
0 as *mut u8
26+
}
27+
28+
#[inline]
29+
pub unsafe fn reallocate_inplace(_ptr: *mut u8, old_size: usize, _size: usize,
30+
_align: usize) -> usize { old_size }
31+
32+
#[inline]
33+
pub fn usable_size(size: usize, _align: usize) -> usize { size }
34+
35+
#[inline]
36+
pub fn stats_print() { }

0 commit comments

Comments
 (0)