Skip to content

Commit 135f334

Browse files
committed
Auto merge of #49580 - glandium:core-heap, r=SimonSapin
Use Alloc and Layout from core::heap. 94d1970 moved the alloc::allocator module to core::heap, moving e.g. Alloc and Layout out of the alloc crate. While alloc::heap reexports them, it's better to use them from where they really come from.
2 parents 73f0871 + b647583 commit 135f334

File tree

9 files changed

+19
-17
lines changed

9 files changed

+19
-17
lines changed

Diff for: src/liballoc/arc.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ use core::sync::atomic::Ordering::{Acquire, Relaxed, Release, SeqCst};
2121
use core::borrow;
2222
use core::fmt;
2323
use core::cmp::Ordering;
24+
use core::heap::{Alloc, Layout};
2425
use core::intrinsics::abort;
2526
use core::mem::{self, align_of_val, size_of_val, uninitialized};
2627
use core::ops::Deref;
@@ -31,7 +32,7 @@ use core::hash::{Hash, Hasher};
3132
use core::{isize, usize};
3233
use core::convert::From;
3334

34-
use heap::{Heap, Alloc, Layout, box_free};
35+
use heap::{Heap, box_free};
3536
use boxed::Box;
3637
use string::String;
3738
use vec::Vec;

Diff for: src/liballoc/boxed.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,15 @@
5555
5656
#![stable(feature = "rust1", since = "1.0.0")]
5757

58-
use heap::{Heap, Layout, Alloc};
58+
use heap::Heap;
5959
use raw_vec::RawVec;
6060

6161
use core::any::Any;
6262
use core::borrow;
6363
use core::cmp::Ordering;
6464
use core::fmt;
6565
use core::hash::{Hash, Hasher};
66+
use core::heap::{Alloc, Layout};
6667
use core::iter::FusedIterator;
6768
use core::marker::{self, Unpin, Unsize};
6869
use core::mem::{self, Pin};

Diff for: src/liballoc/btree/node.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,14 @@
4141
// - A node of length `n` has `n` keys, `n` values, and (in an internal node) `n + 1` edges.
4242
// This implies that even an empty internal node has at least one edge.
4343

44+
use core::heap::{Alloc, Layout};
4445
use core::marker::PhantomData;
4546
use core::mem;
4647
use core::ptr::{self, Unique, NonNull};
4748
use core::slice;
4849

4950
use boxed::Box;
50-
use heap::{Heap, Alloc, Layout};
51+
use heap::Heap;
5152

5253
const B: usize = 6;
5354
pub const MIN_LEN: usize = B - 1;

Diff for: src/liballoc/raw_vec.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,12 @@
99
// except according to those terms.
1010

1111
use core::cmp;
12+
use core::heap::{Alloc, Layout};
1213
use core::mem;
1314
use core::ops::Drop;
1415
use core::ptr::{self, Unique};
1516
use core::slice;
16-
use heap::{Alloc, Layout, Heap};
17+
use heap::Heap;
1718
use super::boxed::Box;
1819
use super::allocator::CollectionAllocErr;
1920
use super::allocator::CollectionAllocErr::*;

Diff for: src/liballoc/rc.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,7 @@ use core::cell::Cell;
250250
use core::cmp::Ordering;
251251
use core::fmt;
252252
use core::hash::{Hash, Hasher};
253+
use core::heap::{Alloc, Layout};
253254
use core::intrinsics::abort;
254255
use core::marker;
255256
use core::marker::{Unsize, PhantomData};
@@ -259,7 +260,7 @@ use core::ops::CoerceUnsized;
259260
use core::ptr::{self, NonNull};
260261
use core::convert::From;
261262

262-
use heap::{Heap, Alloc, Layout, box_free};
263+
use heap::{Heap, box_free};
263264
use string::String;
264265
use vec::Vec;
265266

Diff for: src/liballoc_jemalloc/lib.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
form or name",
1616
issue = "27783")]
1717
#![deny(warnings)]
18-
#![feature(alloc)]
1918
#![feature(alloc_system)]
2019
#![feature(libc)]
2120
#![feature(linkage)]
@@ -25,7 +24,6 @@
2524
#![cfg_attr(not(dummy_jemalloc), feature(allocator_api))]
2625
#![rustc_alloc_kind = "exe"]
2726

28-
extern crate alloc;
2927
extern crate alloc_system;
3028
extern crate libc;
3129

@@ -35,7 +33,7 @@ pub use contents::*;
3533
mod contents {
3634
use core::ptr;
3735

38-
use alloc::heap::{Alloc, AllocErr, Layout};
36+
use core::heap::{Alloc, AllocErr, Layout};
3937
use alloc_system::System;
4038
use libc::{c_int, c_void, size_t};
4139

Diff for: src/liballoc_system/lib.rs

+4-7
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
issue = "32838")]
1818
#![feature(global_allocator)]
1919
#![feature(allocator_api)]
20-
#![feature(alloc)]
2120
#![feature(core_intrinsics)]
2221
#![feature(staged_api)]
2322
#![feature(rustc_attrs)]
@@ -43,9 +42,7 @@ const MIN_ALIGN: usize = 8;
4342
#[allow(dead_code)]
4443
const MIN_ALIGN: usize = 16;
4544

46-
extern crate alloc;
47-
48-
use self::alloc::heap::{Alloc, AllocErr, Layout, Excess, CannotReallocInPlace};
45+
use core::heap::{Alloc, AllocErr, Layout, Excess, CannotReallocInPlace};
4946

5047
#[unstable(feature = "allocator_api", issue = "32838")]
5148
pub struct System;
@@ -125,7 +122,7 @@ mod platform {
125122

126123
use MIN_ALIGN;
127124
use System;
128-
use alloc::heap::{Alloc, AllocErr, Layout};
125+
use core::heap::{Alloc, AllocErr, Layout};
129126

130127
#[unstable(feature = "allocator_api", issue = "32838")]
131128
unsafe impl<'a> Alloc for &'a System {
@@ -279,7 +276,7 @@ mod platform {
279276

280277
use MIN_ALIGN;
281278
use System;
282-
use alloc::heap::{Alloc, AllocErr, Layout, CannotReallocInPlace};
279+
use core::heap::{Alloc, AllocErr, Layout, CannotReallocInPlace};
283280

284281
type LPVOID = *mut u8;
285282
type HANDLE = LPVOID;
@@ -491,7 +488,7 @@ mod platform {
491488
mod platform {
492489
extern crate dlmalloc;
493490

494-
use alloc::heap::{Alloc, AllocErr, Layout, Excess, CannotReallocInPlace};
491+
use core::heap::{Alloc, AllocErr, Layout, Excess, CannotReallocInPlace};
495492
use System;
496493
use self::dlmalloc::GlobalDlmalloc;
497494

Diff for: src/libstd/collections/hash/map.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,10 @@
1111
use self::Entry::*;
1212
use self::VacantEntryState::*;
1313

14-
use alloc::heap::{Heap, Alloc};
14+
use alloc::heap::Heap;
1515
use alloc::allocator::CollectionAllocErr;
1616
use cell::Cell;
17+
use core::heap::Alloc;
1718
use borrow::Borrow;
1819
use cmp::max;
1920
use fmt::{self, Debug};

Diff for: src/libstd/collections/hash/table.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
use alloc::heap::{Heap, Alloc, Layout};
11+
use alloc::heap::Heap;
12+
use core::heap::{Alloc, Layout};
1213

1314
use cmp;
1415
use hash::{BuildHasher, Hash, Hasher};

0 commit comments

Comments
 (0)