Unnamed repository; edit this file 'description' to name the repository.
Merge #10600
10600: minor: Make some functions non-generic r=Veykril a=lnicola This reduces `text` size by 10192 bytes (0.064% :cry:), with no apparent change in performance. Co-authored-by: LaurenČ›iu Nicola <[email protected]>
bors[bot] 2021-10-21
parent c2e3629 · parent 24eca25 · commit d1cdfa8
-rw-r--r--crates/hir_def/src/item_tree/lower.rs8
-rw-r--r--crates/hir_ty/src/infer/expr.rs2
-rw-r--r--crates/hir_ty/src/infer/unify.rs8
3 files changed, 9 insertions, 9 deletions
diff --git a/crates/hir_def/src/item_tree/lower.rs b/crates/hir_def/src/item_tree/lower.rs
index 9c278f5ac6..2926f32b63 100644
--- a/crates/hir_def/src/item_tree/lower.rs
+++ b/crates/hir_def/src/item_tree/lower.rs
@@ -645,7 +645,7 @@ impl<'a> Ctx<'a> {
fn lower_generic_params_and_inner_items(
&mut self,
owner: GenericsOwner<'_>,
- node: &impl ast::HasGenericParams,
+ node: &dyn ast::HasGenericParams,
) -> Interned<GenericParams> {
// Generics are part of item headers and may contain inner items we need to collect.
if let Some(params) = node.generic_param_list() {
@@ -661,7 +661,7 @@ impl<'a> Ctx<'a> {
fn lower_generic_params(
&mut self,
owner: GenericsOwner<'_>,
- node: &impl ast::HasGenericParams,
+ node: &dyn ast::HasGenericParams,
) -> Interned<GenericParams> {
let mut generics = GenericParams::default();
match owner {
@@ -697,7 +697,7 @@ impl<'a> Ctx<'a> {
Interned::new(generics)
}
- fn lower_type_bounds(&mut self, node: &impl ast::HasTypeBounds) -> Vec<Interned<TypeBound>> {
+ fn lower_type_bounds(&mut self, node: &dyn ast::HasTypeBounds) -> Vec<Interned<TypeBound>> {
match node.type_bound_list() {
Some(bound_list) => bound_list
.bounds()
@@ -707,7 +707,7 @@ impl<'a> Ctx<'a> {
}
}
- fn lower_visibility(&mut self, item: &impl ast::HasVisibility) -> RawVisibilityId {
+ fn lower_visibility(&mut self, item: &dyn ast::HasVisibility) -> RawVisibilityId {
let vis = match self.forced_visibility {
Some(vis) => return vis,
None => RawVisibility::from_ast_with_hygiene(self.db, item.visibility(), &self.hygiene),
diff --git a/crates/hir_ty/src/infer/expr.rs b/crates/hir_ty/src/infer/expr.rs
index ada5717f1a..3aad9d4cc8 100644
--- a/crates/hir_ty/src/infer/expr.rs
+++ b/crates/hir_ty/src/infer/expr.rs
@@ -1037,7 +1037,7 @@ impl<'a> InferenceContext<'a> {
if let Some(expected_ty) = expected_output.to_option(&mut self.table) {
self.table.fudge_inference(|table| {
if table.try_unify(&expected_ty, &output).is_ok() {
- table.resolve_with_fallback(inputs, |var, kind, _, _| match kind {
+ table.resolve_with_fallback(inputs, &|var, kind, _, _| match kind {
chalk_ir::VariableKind::Ty(tk) => var.to_ty(&Interner, tk).cast(&Interner),
chalk_ir::VariableKind::Lifetime => {
var.to_lifetime(&Interner).cast(&Interner)
diff --git a/crates/hir_ty/src/infer/unify.rs b/crates/hir_ty/src/infer/unify.rs
index c40ef7f587..852e545bd0 100644
--- a/crates/hir_ty/src/infer/unify.rs
+++ b/crates/hir_ty/src/infer/unify.rs
@@ -128,7 +128,7 @@ pub(crate) fn unify(
Some(Substitution::from_iter(
&Interner,
vars.iter(&Interner)
- .map(|v| table.resolve_with_fallback(v.assert_ty_ref(&Interner).clone(), fallback)),
+ .map(|v| table.resolve_with_fallback(v.assert_ty_ref(&Interner).clone(), &fallback)),
))
}
@@ -291,7 +291,7 @@ impl<'a> InferenceTable<'a> {
pub(crate) fn resolve_with_fallback<T>(
&mut self,
t: T,
- fallback: impl Fn(InferenceVar, VariableKind, GenericArg, DebruijnIndex) -> GenericArg,
+ fallback: &dyn Fn(InferenceVar, VariableKind, GenericArg, DebruijnIndex) -> GenericArg,
) -> T::Result
where
T: HasInterner<Interner = Interner> + Fold<Interner>,
@@ -303,7 +303,7 @@ impl<'a> InferenceTable<'a> {
&mut self,
var_stack: &mut Vec<InferenceVar>,
t: T,
- fallback: &impl Fn(InferenceVar, VariableKind, GenericArg, DebruijnIndex) -> GenericArg,
+ fallback: &dyn Fn(InferenceVar, VariableKind, GenericArg, DebruijnIndex) -> GenericArg,
) -> T::Result
where
T: HasInterner<Interner = Interner> + Fold<Interner>,
@@ -319,7 +319,7 @@ impl<'a> InferenceTable<'a> {
where
T: HasInterner<Interner = Interner> + Fold<Interner>,
{
- self.resolve_with_fallback(t, |_, _, d, _| d)
+ self.resolve_with_fallback(t, &|_, _, d, _| d)
}
/// Unify two types and register new trait goals that arise from that.