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"
|
||||
version = "0.0.0"
|
||||
dependencies = [
|
||||
"rustc_data_structures",
|
||||
"smallvec 1.4.2",
|
||||
]
|
||||
|
||||
|
@ -5,5 +5,4 @@ version = "0.0.0"
|
||||
edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
rustc_data_structures = { path = "../rustc_data_structures" }
|
||||
smallvec = { version = "1.0", features = ["union", "may_dangle"] }
|
||||
|
@ -16,7 +16,6 @@
|
||||
#![feature(maybe_uninit_slice)]
|
||||
#![cfg_attr(test, feature(test))]
|
||||
|
||||
use rustc_data_structures::cold_path;
|
||||
use smallvec::SmallVec;
|
||||
|
||||
use std::alloc::Layout;
|
||||
@ -27,6 +26,12 @@ use std::mem::{self, MaybeUninit};
|
||||
use std::ptr;
|
||||
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.
|
||||
pub struct TypedArena<T> {
|
||||
/// A pointer to the next object to be allocated.
|
||||
|
Loading…
Reference in New Issue
Block a user