Skip to content

Commit 8e6f69a

Browse files
committed
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.
2 parents 9bd740a + 52ff31a commit 8e6f69a

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

Cargo.lock

-1
Original file line numberDiff line numberDiff line change
@@ -3368,7 +3368,6 @@ dependencies = [
33683368
name = "rustc_arena"
33693369
version = "0.0.0"
33703370
dependencies = [
3371-
"rustc_data_structures",
33723371
"smallvec 1.4.2",
33733372
]
33743373

compiler/rustc_arena/Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,4 @@ version = "0.0.0"
55
edition = "2018"
66

77
[dependencies]
8-
rustc_data_structures = { path = "../rustc_data_structures" }
98
smallvec = { version = "1.0", features = ["union", "may_dangle"] }

compiler/rustc_arena/src/lib.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
#![feature(maybe_uninit_slice)]
1717
#![cfg_attr(test, feature(test))]
1818

19-
use rustc_data_structures::cold_path;
2019
use smallvec::SmallVec;
2120

2221
use std::alloc::Layout;
@@ -27,6 +26,12 @@ use std::mem::{self, MaybeUninit};
2726
use std::ptr;
2827
use std::slice;
2928

29+
#[inline(never)]
30+
#[cold]
31+
pub fn cold_path<F: FnOnce() -> R, R>(f: F) -> R {
32+
f()
33+
}
34+
3035
/// An arena that can hold objects of only one type.
3136
pub struct TypedArena<T> {
3237
/// A pointer to the next object to be allocated.

0 commit comments

Comments
 (0)