Skip to content

Commit ce280de

Browse files
committed
Removing rustc_type_ir in the rustc_infer codebase
This commit does the following: - Replaces use of rustc_type_ir by rustc_middle - Removes the rustc_type_ir dependency - The DelayedMap type is exposed by rustc_middle so everything can be accessed through rustc_middle in a coherent manner.
1 parent 0e517d3 commit ce280de

File tree

11 files changed

+19
-33
lines changed

11 files changed

+19
-33
lines changed

Cargo.lock

-1
Original file line numberDiff line numberDiff line change
@@ -3854,7 +3854,6 @@ dependencies = [
38543854
"rustc_macros",
38553855
"rustc_middle",
38563856
"rustc_span",
3857-
"rustc_type_ir",
38583857
"smallvec",
38593858
"thin-vec",
38603859
"tracing",

compiler/rustc_infer/Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ rustc_index = { path = "../rustc_index" }
1616
rustc_macros = { path = "../rustc_macros" }
1717
rustc_middle = { path = "../rustc_middle" }
1818
rustc_span = { path = "../rustc_span" }
19-
rustc_type_ir = { path = "../rustc_type_ir" }
2019
smallvec = { version = "1.8.1", features = ["union", "may_dangle"] }
2120
thin-vec = "0.2.12"
2221
tracing = "0.1"

compiler/rustc_infer/src/infer/context.rs

+10-18
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use rustc_span::{DUMMY_SP, ErrorGuaranteed, Span};
88

99
use super::{BoundRegionConversionTime, InferCtxt, RegionVariableOrigin, SubregionOrigin};
1010

11-
impl<'tcx> rustc_type_ir::InferCtxtLike for InferCtxt<'tcx> {
11+
impl<'tcx> ty::InferCtxtLike for InferCtxt<'tcx> {
1212
type Interner = TyCtxt<'tcx>;
1313

1414
fn cx(&self) -> TyCtxt<'tcx> {
@@ -121,28 +121,28 @@ impl<'tcx> rustc_type_ir::InferCtxtLike for InferCtxt<'tcx> {
121121
self.enter_forall(value, f)
122122
}
123123

124-
fn equate_ty_vids_raw(&self, a: rustc_type_ir::TyVid, b: rustc_type_ir::TyVid) {
124+
fn equate_ty_vids_raw(&self, a: ty::TyVid, b: ty::TyVid) {
125125
self.inner.borrow_mut().type_variables().equate(a, b);
126126
}
127127

128-
fn equate_int_vids_raw(&self, a: rustc_type_ir::IntVid, b: rustc_type_ir::IntVid) {
128+
fn equate_int_vids_raw(&self, a: ty::IntVid, b: ty::IntVid) {
129129
self.inner.borrow_mut().int_unification_table().union(a, b);
130130
}
131131

132-
fn equate_float_vids_raw(&self, a: rustc_type_ir::FloatVid, b: rustc_type_ir::FloatVid) {
132+
fn equate_float_vids_raw(&self, a: ty::FloatVid, b: ty::FloatVid) {
133133
self.inner.borrow_mut().float_unification_table().union(a, b);
134134
}
135135

136-
fn equate_const_vids_raw(&self, a: rustc_type_ir::ConstVid, b: rustc_type_ir::ConstVid) {
136+
fn equate_const_vids_raw(&self, a: ty::ConstVid, b: ty::ConstVid) {
137137
self.inner.borrow_mut().const_unification_table().union(a, b);
138138
}
139139

140140
fn instantiate_ty_var_raw<R: PredicateEmittingRelation<Self>>(
141141
&self,
142142
relation: &mut R,
143143
target_is_expected: bool,
144-
target_vid: rustc_type_ir::TyVid,
145-
instantiation_variance: rustc_type_ir::Variance,
144+
target_vid: ty::TyVid,
145+
instantiation_variance: ty::Variance,
146146
source_ty: Ty<'tcx>,
147147
) -> RelateResult<'tcx, ()> {
148148
self.instantiate_ty_var(
@@ -154,27 +154,19 @@ impl<'tcx> rustc_type_ir::InferCtxtLike for InferCtxt<'tcx> {
154154
)
155155
}
156156

157-
fn instantiate_int_var_raw(
158-
&self,
159-
vid: rustc_type_ir::IntVid,
160-
value: rustc_type_ir::IntVarValue,
161-
) {
157+
fn instantiate_int_var_raw(&self, vid: ty::IntVid, value: ty::IntVarValue) {
162158
self.inner.borrow_mut().int_unification_table().union_value(vid, value);
163159
}
164160

165-
fn instantiate_float_var_raw(
166-
&self,
167-
vid: rustc_type_ir::FloatVid,
168-
value: rustc_type_ir::FloatVarValue,
169-
) {
161+
fn instantiate_float_var_raw(&self, vid: ty::FloatVid, value: ty::FloatVarValue) {
170162
self.inner.borrow_mut().float_unification_table().union_value(vid, value);
171163
}
172164

173165
fn instantiate_const_var_raw<R: PredicateEmittingRelation<Self>>(
174166
&self,
175167
relation: &mut R,
176168
target_is_expected: bool,
177-
target_vid: rustc_type_ir::ConstVid,
169+
target_vid: ty::ConstVid,
178170
source_ct: ty::Const<'tcx>,
179171
) -> RelateResult<'tcx, ()> {
180172
self.instantiate_const_var(relation, target_is_expected, target_vid, source_ct)

compiler/rustc_infer/src/infer/outlives/obligations.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,11 @@ use rustc_data_structures::undo_log::UndoLogs;
6363
use rustc_middle::bug;
6464
use rustc_middle::mir::ConstraintCategory;
6565
use rustc_middle::traits::query::NoSolution;
66+
use rustc_middle::ty::outlives::{Component, push_outlives_components};
6667
use rustc_middle::ty::{
6768
self, GenericArgKind, GenericArgsRef, PolyTypeOutlivesPredicate, Region, Ty, TyCtxt,
6869
TypeFoldable as _, TypeVisitableExt,
6970
};
70-
use rustc_type_ir::outlives::{Component, push_outlives_components};
7171
use smallvec::smallvec;
7272
use tracing::{debug, instrument};
7373

compiler/rustc_infer/src/infer/outlives/verify.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use std::assert_matches::assert_matches;
22

3+
use rustc_middle::ty::outlives::{Component, compute_alias_components_recursive};
34
use rustc_middle::ty::{self, OutlivesPredicate, Ty, TyCtxt};
4-
use rustc_type_ir::outlives::{Component, compute_alias_components_recursive};
55
use smallvec::smallvec;
66
use tracing::{debug, instrument, trace};
77

compiler/rustc_infer/src/infer/relate/mod.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@
22
//! (except for some relations used for diagnostics and heuristics in the compiler).
33
//! As well as the implementation of `Relate` for interned things (`Ty`/`Const`/etc).
44
5-
pub use rustc_middle::ty::relate::RelateResult;
6-
pub use rustc_type_ir::relate::combine::PredicateEmittingRelation;
7-
pub use rustc_type_ir::relate::*;
5+
pub use rustc_middle::ty::relate::combine::PredicateEmittingRelation;
6+
pub use rustc_middle::ty::relate::{RelateResult, *};
87

98
mod generalize;
109
mod higher_ranked;

compiler/rustc_infer/src/infer/relate/type_relating.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,8 @@ use rustc_middle::ty::relate::combine::{super_combine_consts, super_combine_tys}
33
use rustc_middle::ty::relate::{
44
Relate, RelateResult, TypeRelation, relate_args_invariantly, relate_args_with_variances,
55
};
6-
use rustc_middle::ty::{self, Ty, TyCtxt, TyVar};
6+
use rustc_middle::ty::{self, DelayedSet, Ty, TyCtxt, TyVar};
77
use rustc_span::Span;
8-
use rustc_type_ir::data_structures::DelayedSet;
98
use tracing::{debug, instrument};
109

1110
use crate::infer::BoundRegionConversionTime::HigherRankedType;

compiler/rustc_infer/src/infer/resolve.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
use rustc_middle::bug;
22
use rustc_middle::ty::{
3-
self, Const, FallibleTypeFolder, InferConst, Ty, TyCtxt, TypeFoldable, TypeFolder,
3+
self, Const, DelayedMap, FallibleTypeFolder, InferConst, Ty, TyCtxt, TypeFoldable, TypeFolder,
44
TypeSuperFoldable, TypeVisitableExt,
55
};
6-
use rustc_type_ir::data_structures::DelayedMap;
76

87
use super::{FixupError, FixupResult, InferCtxt};
98

compiler/rustc_infer/src/infer/snapshot/fudge.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,8 @@ use std::ops::Range;
33
use rustc_data_structures::{snapshot_vec as sv, unify as ut};
44
use rustc_middle::ty::{
55
self, ConstVid, FloatVid, IntVid, RegionVid, Ty, TyCtxt, TyVid, TypeFoldable, TypeFolder,
6-
TypeSuperFoldable,
6+
TypeSuperFoldable, TypeVisitableExt,
77
};
8-
use rustc_type_ir::TypeVisitableExt;
98
use tracing::instrument;
109
use ut::UnifyKey;
1110

compiler/rustc_infer/src/traits/util.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use rustc_data_structures::fx::FxHashSet;
2+
pub use rustc_middle::ty::elaborate::*;
23
use rustc_middle::ty::{self, TyCtxt};
34
use rustc_span::{Ident, Span};
4-
pub use rustc_type_ir::elaborate::*;
55

66
use crate::traits::{self, Obligation, ObligationCauseCode, PredicateObligation};
77

compiler/rustc_middle/src/ty/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ use rustc_session::lint::LintBuffer;
5050
pub use rustc_session::lint::RegisteredTools;
5151
use rustc_span::hygiene::MacroKind;
5252
use rustc_span::{DUMMY_SP, ExpnId, ExpnKind, Ident, Span, Symbol, kw, sym};
53-
pub use rustc_type_ir::data_structures::DelayedSet;
53+
pub use rustc_type_ir::data_structures::{DelayedMap, DelayedSet};
5454
pub use rustc_type_ir::relate::VarianceDiagInfo;
5555
pub use rustc_type_ir::*;
5656
use tracing::{debug, instrument};

0 commit comments

Comments
 (0)