Skip to content

Commit 861da22

Browse files
committed
Explicitly depend on ena in rustc_type_ir and make the UnifyKey and UnifyValue imports non-nightly
1 parent 04c9649 commit 861da22

File tree

3 files changed

+5
-10
lines changed

3 files changed

+5
-10
lines changed

Diff for: Cargo.lock

+1
Original file line numberDiff line numberDiff line change
@@ -4549,6 +4549,7 @@ version = "0.0.0"
45494549
dependencies = [
45504550
"bitflags 2.6.0",
45514551
"derive-where",
4552+
"ena",
45524553
"indexmap",
45534554
"rustc-hash 1.1.0",
45544555
"rustc_ast_ir",

Diff for: compiler/rustc_type_ir/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ edition = "2021"
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 }

Diff for: compiler/rustc_type_ir/src/ty_kind.rs

+3-10
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
use std::fmt;
22

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

@@ -645,7 +646,6 @@ rustc_index::newtype_index! {
645646
#[encodable]
646647
#[orderable]
647648
#[debug_format = "?{}t"]
648-
#[gate_rustc_only]
649649
pub struct TyVid {}
650650
}
651651

@@ -654,7 +654,6 @@ rustc_index::newtype_index! {
654654
#[encodable]
655655
#[orderable]
656656
#[debug_format = "?{}i"]
657-
#[gate_rustc_only]
658657
pub struct IntVid {}
659658
}
660659

@@ -663,7 +662,6 @@ rustc_index::newtype_index! {
663662
#[encodable]
664663
#[orderable]
665664
#[debug_format = "?{}f"]
666-
#[gate_rustc_only]
667665
pub struct FloatVid {}
668666
}
669667

@@ -706,7 +704,6 @@ pub enum InferTy {
706704

707705
/// Raw `TyVid` are used as the unification key for `sub_relations`;
708706
/// they carry no values.
709-
#[cfg(feature = "nightly")]
710707
impl UnifyKey for TyVid {
711708
type Value = ();
712709
#[inline]
@@ -722,7 +719,6 @@ impl UnifyKey for TyVid {
722719
}
723720
}
724721

725-
#[cfg(feature = "nightly")]
726722
impl UnifyValue for IntVarValue {
727723
type Error = NoError;
728724

@@ -742,7 +738,6 @@ impl UnifyValue for IntVarValue {
742738
}
743739
}
744740

745-
#[cfg(feature = "nightly")]
746741
impl UnifyKey for IntVid {
747742
type Value = IntVarValue;
748743
#[inline] // make this function eligible for inlining - it is quite hot.
@@ -758,7 +753,6 @@ impl UnifyKey for IntVid {
758753
}
759754
}
760755

761-
#[cfg(feature = "nightly")]
762756
impl UnifyValue for FloatVarValue {
763757
type Error = NoError;
764758

@@ -776,7 +770,6 @@ impl UnifyValue for FloatVarValue {
776770
}
777771
}
778772

779-
#[cfg(feature = "nightly")]
780773
impl UnifyKey for FloatVid {
781774
type Value = FloatVarValue;
782775
#[inline]

0 commit comments

Comments
 (0)