Skip to content

Commit 5d7b823

Browse files
committed
Make the crate compile on stable
1 parent 033f471 commit 5d7b823

File tree

4 files changed

+25
-3
lines changed

4 files changed

+25
-3
lines changed

Cargo.lock

+7
Original file line numberDiff line numberDiff line change
@@ -4384,6 +4384,7 @@ dependencies = [
43844384
"rustc_target",
43854385
"smallvec",
43864386
"tracing",
4387+
"typed-arena",
43874388
]
43884389

43894390
[[package]]
@@ -5719,6 +5720,12 @@ dependencies = [
57195720
"rustc-hash",
57205721
]
57215722

5723+
[[package]]
5724+
name = "typed-arena"
5725+
version = "2.0.2"
5726+
source = "registry+https://github.com/rust-lang/crates.io-index"
5727+
checksum = "6af6ae20167a9ece4bcb41af5b80f8a1f1df981f6391189ce00fd257af04126a"
5728+
57225729
[[package]]
57235730
name = "typenum"
57245731
version = "1.16.0"

compiler/rustc_pattern_analysis/Cargo.toml

+12-3
Original file line numberDiff line numberDiff line change
@@ -6,24 +6,28 @@ edition = "2021"
66
[dependencies]
77
# tidy-alphabetical-start
88
rustc_apfloat = "0.2.0"
9-
rustc_arena = { path = "../rustc_arena" }
9+
rustc_arena = { path = "../rustc_arena", optional = true }
1010
rustc_data_structures = { path = "../rustc_data_structures", optional = true }
1111
rustc_errors = { path = "../rustc_errors", optional = true }
1212
rustc_fluent_macro = { path = "../rustc_fluent_macro", optional = true }
1313
rustc_hir = { path = "../rustc_hir", optional = true }
14-
rustc_index = { path = "../rustc_index" }
14+
rustc_index = { path = "../rustc_index", default-features = false }
1515
rustc_macros = { path = "../rustc_macros", optional = true }
1616
rustc_middle = { path = "../rustc_middle", optional = true }
1717
rustc_session = { path = "../rustc_session", optional = true }
1818
rustc_span = { path = "../rustc_span", optional = true }
1919
rustc_target = { path = "../rustc_target", optional = true }
20-
smallvec = { version = "1.8.1", features = ["union", "may_dangle"] }
20+
smallvec = { version = "1.8.1", features = ["union"] }
2121
tracing = "0.1"
22+
typed-arena = { version = "2.0.2", optional = true }
2223
# tidy-alphabetical-end
2324

2425
[features]
2526
default = ["rustc"]
27+
# It's not possible to only enable the `typed_arena` dependency when the `rustc` feature is off, so
28+
# we use another feature instead. The crate won't compile if one of these isn't enabled.
2629
rustc = [
30+
"dep:rustc_arena",
2731
"dep:rustc_data_structures",
2832
"dep:rustc_errors",
2933
"dep:rustc_fluent_macro",
@@ -33,4 +37,9 @@ rustc = [
3337
"dep:rustc_session",
3438
"dep:rustc_span",
3539
"dep:rustc_target",
40+
"smallvec/may_dangle",
41+
"rustc_index/nightly",
42+
]
43+
stable = [
44+
"dep:typed-arena",
3645
]

compiler/rustc_pattern_analysis/src/usefulness.rs

+5
Original file line numberDiff line numberDiff line change
@@ -555,7 +555,12 @@
555555
use smallvec::{smallvec, SmallVec};
556556
use std::fmt;
557557

558+
// It's not possible to only enable the `typed_arena` dependency when the `rustc` feature is off, so
559+
// we use another feature instead. The crate won't compile if one of these isn't enabled.
560+
#[cfg(feature = "rustc")]
558561
use rustc_arena::TypedArena;
562+
#[cfg(feature = "stable")]
563+
use typed_arena::Arena as TypedArena;
559564

560565
use crate::constructor::{Constructor, ConstructorSet};
561566
use crate::pat::{DeconstructedPat, WitnessPat};

src/tools/tidy/src/deps.rs

+1
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,7 @@ const PERMITTED_RUSTC_DEPENDENCIES: &[&str] = &[
359359
"tracing-tree",
360360
"twox-hash",
361361
"type-map",
362+
"typed-arena",
362363
"typenum",
363364
"unic-langid",
364365
"unic-langid-impl",

0 commit comments

Comments
 (0)