Skip to content

Commit 060902e

Browse files
committed
Explicitly depend on ena in rustc_type_ir and make the UnifyKey and UnifyValue imports non-nightly
1 parent bad13a9 commit 060902e

File tree

3 files changed

+5
-7
lines changed

3 files changed

+5
-7
lines changed

Cargo.lock

+1
Original file line numberDiff line numberDiff line change
@@ -4581,6 +4581,7 @@ version = "0.0.0"
45814581
dependencies = [
45824582
"bitflags",
45834583
"derive-where",
4584+
"ena",
45844585
"indexmap",
45854586
"rustc-hash 1.1.0",
45864587
"rustc_ast_ir",

compiler/rustc_type_ir/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ edition = "2024"
77
# tidy-alphabetical-start
88
bitflags = "2.4.1"
99
derive-where = "1.2.7"
10+
ena = "0.14.3"
1011
indexmap = "2.0.0"
1112
rustc-hash = "1.1.0"
1213
rustc_ast_ir = { path = "../rustc_ast_ir", default-features = false }

compiler/rustc_type_ir/src/ty_kind.rs

+3-7
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@ use std::fmt;
22
use std::ops::Deref;
33

44
use derive_where::derive_where;
5+
// We *would* normally import these through `rustc_data_structures`, but external
6+
// users (i.e. rust-analyzer) may need the impls for these traits.
7+
use ena::unify::{NoError, UnifyKey, UnifyValue};
58
use rustc_ast_ir::Mutability;
69
#[cfg(feature = "nightly")]
710
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
811
#[cfg(feature = "nightly")]
9-
use rustc_data_structures::unify::{NoError, UnifyKey, UnifyValue};
10-
#[cfg(feature = "nightly")]
1112
use rustc_macros::{Decodable_NoContext, Encodable_NoContext, HashStable_NoContext};
1213
use rustc_type_ir_macros::{Lift_Generic, TypeFoldable_Generic, TypeVisitable_Generic};
1314

@@ -796,7 +797,6 @@ pub enum InferTy {
796797

797798
/// Raw `TyVid` are used as the unification key for `sub_relations`;
798799
/// they carry no values.
799-
#[cfg(feature = "nightly")]
800800
impl UnifyKey for TyVid {
801801
type Value = ();
802802
#[inline]
@@ -812,7 +812,6 @@ impl UnifyKey for TyVid {
812812
}
813813
}
814814

815-
#[cfg(feature = "nightly")]
816815
impl UnifyValue for IntVarValue {
817816
type Error = NoError;
818817

@@ -832,7 +831,6 @@ impl UnifyValue for IntVarValue {
832831
}
833832
}
834833

835-
#[cfg(feature = "nightly")]
836834
impl UnifyKey for IntVid {
837835
type Value = IntVarValue;
838836
#[inline] // make this function eligible for inlining - it is quite hot.
@@ -848,7 +846,6 @@ impl UnifyKey for IntVid {
848846
}
849847
}
850848

851-
#[cfg(feature = "nightly")]
852849
impl UnifyValue for FloatVarValue {
853850
type Error = NoError;
854851

@@ -866,7 +863,6 @@ impl UnifyValue for FloatVarValue {
866863
}
867864
}
868865

869-
#[cfg(feature = "nightly")]
870866
impl UnifyKey for FloatVid {
871867
type Value = FloatVarValue;
872868
#[inline]

0 commit comments

Comments
 (0)