Skip to content

Commit 51e2875

Browse files
committed
Remap I::Const -> Const<I>
1 parent e83bfca commit 51e2875

30 files changed

Lines changed: 105 additions & 104 deletions

‎compiler/rustc_next_trait_solver/src/canonical/canonicalizer.rs‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ use rustc_type_ir::inherent::*;
55
use rustc_type_ir::solve::{Goal, QueryInput};
66
use rustc_type_ir::{
77
self as ty, Canonical, CanonicalParamEnvCacheEntry, CanonicalVarKind, CanonicalizerState,
8-
Flags, InferCtxtLike, Interner, PlaceholderConst, PlaceholderType, PredicateProxy, Region,
9-
TypeFlags, TypeFoldable, TypeFolder, TypeSuperFoldable, TypeVisitableExt,
8+
Const, Flags, InferCtxtLike, Interner, PlaceholderConst, PlaceholderType, PredicateProxy,
9+
Region, TypeFlags, TypeFoldable, TypeFolder, TypeSuperFoldable, TypeVisitableExt,
1010
};
1111
use thin_vec::ThinVec;
1212

@@ -525,7 +525,7 @@ impl<D: SolverDelegate<Interner = I>, I: Interner> TypeFolder<I> for Canonicaliz
525525
}
526526
}
527527

528-
fn fold_const(&mut self, c: I::Const) -> I::Const {
528+
fn fold_const(&mut self, c: Const<I>) -> Const<I> {
529529
if !c.flags().intersects(NEEDS_CANONICAL) {
530530
return c;
531531
}

‎compiler/rustc_next_trait_solver/src/canonical/mod.rs‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ use rustc_type_ir::relate::{
1818
self, Relate, RelateResult, TypeRelation, VarianceDiagInfo, relate_args_invariantly,
1919
};
2020
use rustc_type_ir::{
21-
self as ty, Canonical, CanonicalVarKind, CanonicalVarValues, InferCtxtLike, Interner, Region,
22-
TypeFoldable, TypingMode, TypingModeEqWrapper,
21+
self as ty, Canonical, CanonicalVarKind, CanonicalVarValues, Const, InferCtxtLike, Interner,
22+
Region, TypeFoldable, TypingMode, TypingModeEqWrapper,
2323
};
2424
use thin_vec::ThinVec;
2525
use tracing::instrument;
@@ -421,7 +421,7 @@ where
421421
}
422422

423423
#[instrument(skip(self), level = "trace")]
424-
fn consts(&mut self, a: I::Const, b: I::Const) -> RelateResult<I, I::Const> {
424+
fn consts(&mut self, a: Const<I>, b: Const<I>) -> RelateResult<I, Const<I>> {
425425
if a == b {
426426
return Ok(a);
427427
}

‎compiler/rustc_next_trait_solver/src/coherence.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use derive_where::derive_where;
55
use rustc_type_ir::inherent::*;
66
use rustc_type_ir::lang_items::SolverAdtLangItem;
77
use rustc_type_ir::{
8-
self as ty, InferCtxtLike, Interner, Region, TrivialTypeTraversalImpls, TypeVisitable,
8+
self as ty, Const, InferCtxtLike, Interner, Region, TrivialTypeTraversalImpls, TypeVisitable,
99
TypeVisitableExt, TypeVisitor,
1010
};
1111
use tracing::instrument;
@@ -469,7 +469,7 @@ where
469469
/// As these should be quite rare as const arguments and especially rare as impl
470470
/// parameters, allowing uncovered const parameters in impls seems more useful
471471
/// than allowing `impl<T> Trait<local_fn_ptr, T> for i32` to compile.
472-
fn visit_const(&mut self, _c: I::Const) -> Self::Result {
472+
fn visit_const(&mut self, _c: Const<I>) -> Self::Result {
473473
ControlFlow::Continue(())
474474
}
475475
}

‎compiler/rustc_next_trait_solver/src/delegate.rs‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use rustc_type_ir::solve::{
55
Certainty, ComputeGoalFastPathOutcome, FetchEligibleAssocItemResponse, Goal, NoSolution,
66
VisibleForLeakCheck,
77
};
8-
use rustc_type_ir::{self as ty, CanonicalizerState, InferCtxtLike, Interner, TypeFoldable};
8+
use rustc_type_ir::{self as ty, CanonicalizerState, Const, InferCtxtLike, Interner, TypeFoldable};
99

1010
/// `SolverDelegate` is one of the two traits in the `rustc_type_ir` shared abstraction layer
1111
/// between rustc and rust-analyzer abstracting over the [InferCtxt][inferctxt-doc], which had to be
@@ -63,7 +63,7 @@ pub trait SolverDelegate: Deref<Target = Self::Infcx> + Sized {
6363
normalize_ty: impl FnOnce(
6464
ty::Unnormalized<Self::Interner, <Self::Interner as Interner>::Ty>,
6565
) -> Result<<Self::Interner as Interner>::Ty, E>,
66-
) -> Result<Option<<Self::Interner as Interner>::Const>, E>;
66+
) -> Result<Option<Const<Self::Interner>>, E>;
6767

6868
// FIXME: This only is here because `wf::obligations` is in `rustc_trait_selection`!
6969
fn well_formed_goals(
@@ -112,7 +112,7 @@ pub trait SolverDelegate: Deref<Target = Self::Infcx> + Sized {
112112
&self,
113113
src: <Self::Interner as Interner>::Ty,
114114
dst: <Self::Interner as Interner>::Ty,
115-
assume: <Self::Interner as Interner>::Const,
115+
assume: Const<Self::Interner>,
116116
) -> Result<Certainty, NoSolution>;
117117

118118
/// Obtain canonicalizer state, either by allocating it afresh (the default) or by reusing

‎compiler/rustc_next_trait_solver/src/normalize.rs‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ use std::fmt::Debug;
22

33
use rustc_type_ir::inherent::*;
44
use rustc_type_ir::{
5-
self as ty, AliasTerm, Binder, FallibleTypeFolder, InferCtxtLike, Interner, PredicateProxy,
6-
TypeFoldable, TypeSuperFoldable, TypeVisitableExt, UniverseIndex,
5+
self as ty, AliasTerm, Binder, Const, FallibleTypeFolder, InferCtxtLike, Interner,
6+
PredicateProxy, TypeFoldable, TypeSuperFoldable, TypeVisitableExt, UniverseIndex,
77
};
88
use tracing::instrument;
99

@@ -147,7 +147,7 @@ where
147147
}
148148

149149
#[instrument(level = "trace", skip(self), ret)]
150-
fn try_fold_const(&mut self, ct: I::Const) -> Result<I::Const, Self::Error> {
150+
fn try_fold_const(&mut self, ct: Const<I>) -> Result<Const<I>, Self::Error> {
151151
let infcx = self.infcx;
152152
let original = ct;
153153

‎compiler/rustc_next_trait_solver/src/placeholder.rs‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@ use core::panic;
33
use rustc_type_ir::data_structures::IndexMap;
44
use rustc_type_ir::inherent::*;
55
use rustc_type_ir::{
6-
self as ty, InferCtxtLike, Interner, PlaceholderConst, PlaceholderRegion, PlaceholderType,
7-
PredicateProxy, Region, TypeFoldable, TypeFolder, TypeSuperFoldable, TypeVisitableExt,
6+
self as ty, Const, InferCtxtLike, Interner, PlaceholderConst, PlaceholderRegion,
7+
PlaceholderType, PredicateProxy, Region, TypeFoldable, TypeFolder, TypeSuperFoldable,
8+
TypeVisitableExt,
89
};
910
use tracing::debug;
1011

@@ -160,7 +161,7 @@ where
160161
}
161162
}
162163

163-
fn fold_const(&mut self, ct: I::Const) -> I::Const {
164+
fn fold_const(&mut self, ct: Const<I>) -> Const<I> {
164165
match ct.kind() {
165166
ty::ConstKind::Bound(ty::BoundVarIndexKind::Bound(debruijn), _)
166167
if debruijn.as_usize() + 1
@@ -310,7 +311,7 @@ where
310311
}
311312
}
312313

313-
fn fold_const(&mut self, ct: I::Const) -> I::Const {
314+
fn fold_const(&mut self, ct: Const<I>) -> Const<I> {
314315
let ct = self.infcx.shallow_resolve_const(ct);
315316
if let ty::ConstKind::Placeholder(p) = ct.kind() {
316317
let replace_var = self.mapped_consts.get(&p);

‎compiler/rustc_next_trait_solver/src/solve/assembly/mod.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use rustc_type_ir::solve::{
1414
RerunNonErased, RerunReason, RerunResultExt, SizedTraitKind, StalledOnCoroutines,
1515
};
1616
use rustc_type_ir::{
17-
self as ty, AliasTy, Interner, MayBeErased, Region, TypeFlags, TypeFoldable, TypeFolder,
17+
self as ty, AliasTy, Const, Interner, MayBeErased, Region, TypeFlags, TypeFoldable, TypeFolder,
1818
TypeSuperFoldable, TypeSuperVisitable, TypeVisitable, TypeVisitableExt, TypeVisitor,
1919
TypingMode, Unnormalized, Upcast, elaborate,
2020
};
@@ -1466,7 +1466,7 @@ where
14661466
}
14671467
}
14681468

1469-
fn visit_const(&mut self, ct: I::Const) -> Self::Result {
1469+
fn visit_const(&mut self, ct: Const<I>) -> Self::Result {
14701470
let ct = self.ecx.replace_bound_vars(ct, &mut self.universes);
14711471
let Ok(ct) = self.ecx.structurally_normalize_const(self.param_env, ct) else {
14721472
return ControlFlow::Break(Err(NoSolution));

‎compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use rustc_type_ir::solve::{
1717
RerunNonErased, RerunReason, RerunResultExt, SmallCopySet, TyOrConstInferVar,
1818
};
1919
use rustc_type_ir::{
20-
self as ty, CanonicalVarValues, ClauseKind, InferCtxtLike, Interner, MayBeErased,
20+
self as ty, CanonicalVarValues, ClauseKind, Const, InferCtxtLike, Interner, MayBeErased,
2121
OpaqueTypeKey, PredicateKind, PredicateProxy, Region, RegionVid, TypeFoldable,
2222
TypeSuperVisitable, TypeVisitable, TypeVisitableExt, TypeVisitor, TypingMode, max_universe,
2323
};
@@ -1057,7 +1057,7 @@ where
10571057
ty
10581058
}
10591059

1060-
pub(super) fn next_const_infer(&mut self) -> I::Const {
1060+
pub(super) fn next_const_infer(&mut self) -> Const<I> {
10611061
let ct = self.delegate.next_const_infer();
10621062
self.inspect.add_var_value(ct);
10631063
ct
@@ -1154,7 +1154,7 @@ where
11541154
ControlFlow::Continue(())
11551155
}
11561156

1157-
fn visit_const(&mut self, c: I::Const) -> Self::Result {
1157+
fn visit_const(&mut self, c: Const<I>) -> Self::Result {
11581158
match c.kind() {
11591159
ty::ConstKind::Infer(ty::InferConst::Var(vid)) => {
11601160
if let ty::TermKind::Const(term) = self.term.kind()
@@ -1409,7 +1409,7 @@ where
14091409
&mut self,
14101410
param_env: I::ParamEnv,
14111411
alias_const: ty::AliasConst<I>,
1412-
) -> Result<Option<I::Const>, NoSolutionOrRerunNonErased> {
1412+
) -> Result<Option<Const<I>>, NoSolutionOrRerunNonErased> {
14131413
if self.typing_mode().is_erased_not_coherence() {
14141414
match self.opaque_accesses.rerun_always(RerunReason::EvaluateConst)? {}
14151415
}
@@ -1470,7 +1470,7 @@ where
14701470
&mut self,
14711471
src: I::Ty,
14721472
dst: I::Ty,
1473-
assume: I::Const,
1473+
assume: Const<I>,
14741474
) -> Result<Certainty, NoSolution> {
14751475
self.delegate.is_transmutable(dst, src, assume)
14761476
}
@@ -1760,7 +1760,7 @@ fn filter_irrelevant_region_constraints<D, I>(
17601760
}
17611761
t.super_visit_with(self);
17621762
}
1763-
fn visit_const(&mut self, c: I::Const) {
1763+
fn visit_const(&mut self, c: Const<I>) {
17641764
// The same goes for consts.
17651765
if !c.has_infer_regions() {
17661766
return;

‎compiler/rustc_next_trait_solver/src/solve/eval_ctxt/solver_region_constraints.rs‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ use rustc_type_ir::region_constraint::{
1111
propagate_ambiguity,
1212
};
1313
use rustc_type_ir::{
14-
AliasTy, Binder, ClauseKind, InferCtxtLike, Interner, Region, TypeVisitable, TypeVisitableExt,
15-
TypeVisitor, UniverseIndex,
14+
AliasTy, Binder, ClauseKind, Const, InferCtxtLike, Interner, Region, TypeVisitable,
15+
TypeVisitableExt, TypeVisitor, UniverseIndex,
1616
};
1717
use tracing::{debug, instrument};
1818

@@ -63,7 +63,7 @@ where
6363
);
6464
}
6565

66-
fn visit_const(&mut self, c: I::Const) {
66+
fn visit_const(&mut self, c: Const<I>) {
6767
self.out.extend(
6868
self.ecx
6969
.well_formed_goals(self.param_env, c.into())

‎compiler/rustc_next_trait_solver/src/solve/mod.rs‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ mod trait_goals;
2323
use derive_where::derive_where;
2424
use rustc_type_ir::inherent::*;
2525
pub use rustc_type_ir::solve::*;
26-
use rustc_type_ir::{self as ty, Interner, Region, TypeVisitableExt};
26+
use rustc_type_ir::{self as ty, Const, Interner, Region, TypeVisitableExt};
2727
use tracing::instrument;
2828

2929
pub use self::eval_ctxt::{
@@ -205,7 +205,7 @@ where
205205
#[instrument(level = "trace", skip(self))]
206206
fn compute_const_evaluatable_goal(
207207
&mut self,
208-
Goal { param_env, predicate: ct }: Goal<I, I::Const>,
208+
Goal { param_env, predicate: ct }: Goal<I, Const<I>>,
209209
) -> QueryResultOrRerunNonErased<I> {
210210
match ct.kind() {
211211
ty::ConstKind::Alias(ty::IsRigid::Yes, _)
@@ -248,7 +248,7 @@ where
248248
#[instrument(level = "trace", skip(self), ret)]
249249
fn compute_const_arg_has_type_goal(
250250
&mut self,
251-
goal: Goal<I, (I::Const, I::Ty)>,
251+
goal: Goal<I, (Const<I>, I::Ty)>,
252252
) -> QueryResultOrRerunNonErased<I> {
253253
let (ct, ty) = goal.predicate;
254254
let ct = self.structurally_normalize_const(goal.param_env, ct)?;
@@ -375,8 +375,8 @@ where
375375
fn structurally_normalize_const(
376376
&mut self,
377377
param_env: I::ParamEnv,
378-
ct: I::Const,
379-
) -> Result<I::Const, NoSolutionOrRerunNonErased> {
378+
ct: Const<I>,
379+
) -> Result<Const<I>, NoSolutionOrRerunNonErased> {
380380
self.structurally_normalize_term(param_env, ct.into()).map(|term| term.expect_const())
381381
}
382382

0 commit comments

Comments
 (0)