Skip to content

Commit

Permalink
Arena: Copy cold_path and remove rustc_data_structures dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
bugadani committed Oct 15, 2020
1 parent 5565241 commit 52ff31a
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 @@ -3350,7 +3350,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 52ff31a

Please sign in to comment.