Arena: Copy cold_path and remove rustc_data_structures dependency
This commit is contained in:
parent
5565241f65
commit
52ff31a7eb
@ -3350,7 +3350,6 @@ dependencies = [
|
|||||||
name = "rustc_arena"
|
name = "rustc_arena"
|
||||||
version = "0.0.0"
|
version = "0.0.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"rustc_data_structures",
|
|
||||||
"smallvec 1.4.2",
|
"smallvec 1.4.2",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -5,5 +5,4 @@ version = "0.0.0"
|
|||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
rustc_data_structures = { path = "../rustc_data_structures" }
|
|
||||||
smallvec = { version = "1.0", features = ["union", "may_dangle"] }
|
smallvec = { version = "1.0", features = ["union", "may_dangle"] }
|
||||||
|
@ -16,7 +16,6 @@
|
|||||||
#![feature(maybe_uninit_slice)]
|
#![feature(maybe_uninit_slice)]
|
||||||
#![cfg_attr(test, feature(test))]
|
#![cfg_attr(test, feature(test))]
|
||||||
|
|
||||||
use rustc_data_structures::cold_path;
|
|
||||||
use smallvec::SmallVec;
|
use smallvec::SmallVec;
|
||||||
|
|
||||||
use std::alloc::Layout;
|
use std::alloc::Layout;
|
||||||
@ -27,6 +26,12 @@
|
|||||||
use std::ptr;
|
use std::ptr;
|
||||||
use std::slice;
|
use std::slice;
|
||||||
|
|
||||||
|
#[inline(never)]
|
||||||
|
#[cold]
|
||||||
|
pub fn cold_path<F: FnOnce() -> R, R>(f: F) -> R {
|
||||||
|
f()
|
||||||
|
}
|
||||||
|
|
||||||
/// An arena that can hold objects of only one type.
|
/// An arena that can hold objects of only one type.
|
||||||
pub struct TypedArena<T> {
|
pub struct TypedArena<T> {
|
||||||
/// A pointer to the next object to be allocated.
|
/// A pointer to the next object to be allocated.
|
||||||
|
Loading…
Reference in New Issue
Block a user