Skip to content

Commit 69ef3a0

Browse files
committed
Naming and comment changes
1 parent d142895 commit 69ef3a0

File tree

5 files changed

+10
-15
lines changed

5 files changed

+10
-15
lines changed

chalk-integration/src/lowering.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1037,11 +1037,11 @@ impl LowerTy for Ty {
10371037
.map(|id| chalk_ir::ParameterKind::Lifetime(id.str)),
10381038
)?;
10391039

1040-
let quantified_ty = chalk_ir::Fn {
1040+
let function = chalk_ir::Fn {
10411041
num_binders: lifetime_names.len(),
10421042
parameters: vec![ty.lower(&quantified_env)?.cast()],
10431043
};
1044-
Ok(chalk_ir::TyData::Function(quantified_ty).intern())
1044+
Ok(chalk_ir::TyData::Function(function).intern())
10451045
}
10461046
}
10471047
}

chalk-ir/src/debug.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ impl<TF: TypeFamily> Debug for TyData<TF> {
6363
TyData::Apply(apply) => write!(fmt, "{:?}", apply),
6464
TyData::Projection(proj) => write!(fmt, "{:?}", proj),
6565
TyData::Placeholder(index) => write!(fmt, "{:?}", index),
66-
TyData::Function(quantified_ty) => write!(fmt, "{:?}", quantified_ty),
66+
TyData::Function(function) => write!(fmt, "{:?}", function),
6767
}
6868
}
6969
}

chalk-ir/src/fold.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -324,9 +324,7 @@ where
324324
TyData::Projection(proj) => {
325325
Ok(TyData::Projection(proj.fold_with(folder, binders)?).intern())
326326
}
327-
TyData::Function(quantified_ty) => {
328-
Ok(TyData::Function(quantified_ty.fold_with(folder, binders)?).intern())
329-
}
327+
TyData::Function(fun) => Ok(TyData::Function(fun.fold_with(folder, binders)?).intern()),
330328
}
331329
}
332330

chalk-ir/src/lib.rs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -260,13 +260,10 @@ pub enum TyData<TF: TypeFamily> {
260260
/// trait and all its parameters are fully known.
261261
Projection(ProjectionTy<TF>),
262262

263-
/// A "higher-ranked" type. In the Rust surface syntax, this can
264-
/// only be a function type (e.g., `for<'a> fn(&'a u32)`) or a dyn
265-
/// type (e.g., `dyn for<'a> SomeTrait<&'a u32>`). However, in
266-
/// Chalk's representation, we separate out the `for<'a>` part
267-
/// from the underlying type, so technically we can represent
268-
/// things like `for<'a> SomeStruct<'a>`, although that has no
269-
/// meaning in Rust.
263+
/// A function type such as `for<'a> fn(&'a u32)`.
264+
/// Note that "higher-ranked" types (starting with `for<>`) are either
265+
/// function types or dyn types, and do not appear otherwise in Rust
266+
/// surface syntax.
270267
Function(Fn<TF>),
271268

272269
/// References the binding at the given depth. The index is a [de

chalk-solve/src/infer/unify.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,8 @@ impl<'t, TF: TypeFamily> Unifier<'t, TF> {
118118
| (&TyData::Function(_), &TyData::InferenceVar(var)) => self.unify_var_ty(var, a),
119119

120120
// Unifying `forall<X> { T }` with some other forall type `forall<X> { U }`
121-
(&TyData::Function(ref quantified_ty1), &TyData::Function(ref quantified_ty2)) => {
122-
self.unify_binders(quantified_ty1, quantified_ty2)
121+
(&TyData::Function(ref fn1), &TyData::Function(ref fn2)) => {
122+
self.unify_binders(fn1, fn2)
123123
}
124124

125125
// This would correspond to unifying a `fn` type with a non-fn

0 commit comments

Comments
 (0)