Use the name var_kinds more.
Variables that are collections of `CanonicalVarKind` are sometimes called `var_kinds` and sometimes called `variables`. The former is much better, because `variables` is (a) non-descript, and (b) often used nearby for collections of `I::GenericArg`. I found the inconsistency made the canonicalization code harder to understand. This commit renames various `variables` things as `var_kinds`.
This commit is contained in:
parent
0ad7701b04
commit
4ae3c85a5e
26 changed files with 114 additions and 114 deletions
|
|
@ -106,8 +106,8 @@ impl<'a, D: SolverDelegate<Interner = I>, I: Interner> Canonicalizer<'a, D, I> {
|
|||
};
|
||||
debug_assert!(!value.has_infer(), "unexpected infer in {value:?}");
|
||||
debug_assert!(!value.has_placeholders(), "unexpected placeholders in {value:?}");
|
||||
let (max_universe, variables) = canonicalizer.finalize();
|
||||
Canonical { max_universe, variables, value }
|
||||
let (max_universe, var_kinds) = canonicalizer.finalize();
|
||||
Canonical { max_universe, var_kinds, value }
|
||||
}
|
||||
|
||||
fn canonicalize_param_env(
|
||||
|
|
@ -235,8 +235,8 @@ impl<'a, D: SolverDelegate<Interner = I>, I: Interner> Canonicalizer<'a, D, I> {
|
|||
|
||||
debug_assert!(!value.has_infer(), "unexpected infer in {value:?}");
|
||||
debug_assert!(!value.has_placeholders(), "unexpected placeholders in {value:?}");
|
||||
let (max_universe, variables) = rest_canonicalizer.finalize();
|
||||
Canonical { max_universe, variables, value }
|
||||
let (max_universe, var_kinds) = rest_canonicalizer.finalize();
|
||||
Canonical { max_universe, var_kinds, value }
|
||||
}
|
||||
|
||||
fn get_or_insert_bound_var(
|
||||
|
|
|
|||
|
|
@ -154,7 +154,7 @@ where
|
|||
//
|
||||
// We therefore instantiate the existential variable in the canonical response with the
|
||||
// inference variable of the input right away, which is more performant.
|
||||
let mut opt_values = IndexVec::from_elem_n(None, response.variables.len());
|
||||
let mut opt_values = IndexVec::from_elem_n(None, response.var_kinds.len());
|
||||
for (original_value, result_value) in iter::zip(original_values, var_values.var_values.iter()) {
|
||||
match result_value.kind() {
|
||||
ty::GenericArgKind::Type(t) => {
|
||||
|
|
@ -164,7 +164,7 @@ where
|
|||
// more involved. They are also a lot rarer than region variables.
|
||||
if let ty::Bound(index_kind, b) = t.kind()
|
||||
&& !matches!(
|
||||
response.variables.get(b.var().as_usize()).unwrap(),
|
||||
response.var_kinds.get(b.var().as_usize()).unwrap(),
|
||||
CanonicalVarKind::Ty { .. }
|
||||
)
|
||||
{
|
||||
|
|
@ -186,7 +186,7 @@ where
|
|||
}
|
||||
}
|
||||
}
|
||||
CanonicalVarValues::instantiate(delegate.cx(), response.variables, |var_values, kind| {
|
||||
CanonicalVarValues::instantiate(delegate.cx(), response.var_kinds, |var_values, kind| {
|
||||
if kind.universe() != ty::UniverseIndex::ROOT {
|
||||
// A variable from inside a binder of the query. While ideally these shouldn't
|
||||
// exist at all (see the FIXME at the start of this method), we have to deal with
|
||||
|
|
@ -342,14 +342,14 @@ where
|
|||
pub fn response_no_constraints_raw<I: Interner>(
|
||||
cx: I,
|
||||
max_universe: ty::UniverseIndex,
|
||||
variables: I::CanonicalVarKinds,
|
||||
var_kinds: I::CanonicalVarKinds,
|
||||
certainty: Certainty,
|
||||
) -> CanonicalResponse<I> {
|
||||
ty::Canonical {
|
||||
max_universe,
|
||||
variables,
|
||||
var_kinds,
|
||||
value: Response {
|
||||
var_values: ty::CanonicalVarValues::make_identity(cx, variables),
|
||||
var_values: ty::CanonicalVarValues::make_identity(cx, var_kinds),
|
||||
// FIXME: maybe we should store the "no response" version in cx, like
|
||||
// we do for cx.types and stuff.
|
||||
external_constraints: cx.mk_external_constraints(ExternalConstraintsData::default()),
|
||||
|
|
|
|||
|
|
@ -97,7 +97,7 @@ where
|
|||
|
||||
/// The variable info for the `var_values`, only used to make an ambiguous response
|
||||
/// with no constraints.
|
||||
variables: I::CanonicalVarKinds,
|
||||
var_kinds: I::CanonicalVarKinds,
|
||||
|
||||
/// What kind of goal we're currently computing, see the enum definition
|
||||
/// for more info.
|
||||
|
|
@ -325,7 +325,7 @@ where
|
|||
// which we don't do within this evaluation context.
|
||||
max_input_universe: ty::UniverseIndex::ROOT,
|
||||
initial_opaque_types_storage_num_entries: Default::default(),
|
||||
variables: Default::default(),
|
||||
var_kinds: Default::default(),
|
||||
var_values: CanonicalVarValues::dummy(),
|
||||
current_goal_kind: CurrentGoalKind::Misc,
|
||||
origin_span,
|
||||
|
|
@ -376,7 +376,7 @@ where
|
|||
let initial_opaque_types_storage_num_entries = delegate.opaque_types_storage_num_entries();
|
||||
let mut ecx = EvalCtxt {
|
||||
delegate,
|
||||
variables: canonical_input.canonical.variables,
|
||||
var_kinds: canonical_input.canonical.var_kinds,
|
||||
var_values,
|
||||
current_goal_kind: CurrentGoalKind::from_query_input(cx, input),
|
||||
max_input_universe: canonical_input.canonical.max_universe,
|
||||
|
|
@ -1323,7 +1323,7 @@ where
|
|||
response_no_constraints_raw(
|
||||
self.cx(),
|
||||
self.max_input_universe,
|
||||
self.variables,
|
||||
self.var_kinds,
|
||||
Certainty::Maybe { cause, opaque_types_jank },
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ where
|
|||
let max_input_universe = outer.max_input_universe;
|
||||
let mut nested = EvalCtxt {
|
||||
delegate,
|
||||
variables: outer.variables,
|
||||
var_kinds: outer.var_kinds,
|
||||
var_values: outer.var_values,
|
||||
current_goal_kind: outer.current_goal_kind,
|
||||
max_input_universe,
|
||||
|
|
|
|||
|
|
@ -143,7 +143,7 @@ fn response_no_constraints<I: Interner>(
|
|||
Ok(response_no_constraints_raw(
|
||||
cx,
|
||||
input.canonical.max_universe,
|
||||
input.canonical.variables,
|
||||
input.canonical.var_kinds,
|
||||
certainty,
|
||||
))
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue