Auto merge of #77962 - bugadani:arena2, r=Mark-Simulacrum

Remove arena's dependency on `rustc_data_structures`

`rustc_arena` currently has a dependency on `rustc_data_structures` because of a trivial "don't inline me" function. This PR copies that function and removes the dependency.
This commit is contained in:
bors 2020-10-16 04:40:53 +00:00
commit 8e6f69afc9
3 changed files with 6 additions and 3 deletions

View File

@ -3368,7 +3368,6 @@ dependencies = [
name = "rustc_arena"
version = "0.0.0"
dependencies = [
"rustc_data_structures",
"smallvec 1.4.2",
]

View File

@ -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"] }

View File

@ -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.