Skip to content

Commit

Permalink
Auto merge of #77962 - bugadani:arena2, r=Mark-Simulacrum
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
bors committed Oct 16, 2020
2 parents 9bd740a + 52ff31a commit 8e6f69a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
1 change: 0 additions & 1 deletion Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3368,7 +3368,6 @@ dependencies = [
name = "rustc_arena"
version = "0.0.0"
dependencies = [
"rustc_data_structures",
"smallvec 1.4.2",
]

Expand Down
1 change: 0 additions & 1 deletion compiler/rustc_arena/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"] }
7 changes: 6 additions & 1 deletion compiler/rustc_arena/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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.
Expand Down

0 comments on commit 8e6f69a

Please sign in to comment.