From 9faea2364dee4fbc9391ad233c570b70256ef002 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 13 Mar 2020 16:05:46 +0100 Subject: Use `dyn Trait` for working with databse It improves compile time in `--release` mode quite a bit, it doesn't really slow things down and, conceptually, it seems closer to what we want the physical architecture to look like (we don't want to monomorphise EVERYTHING in a single leaf crate). --- crates/ra_hir_ty/src/autoderef.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'crates/ra_hir_ty/src/autoderef.rs') diff --git a/crates/ra_hir_ty/src/autoderef.rs b/crates/ra_hir_ty/src/autoderef.rs index f32d5786a..53e81e85d 100644 --- a/crates/ra_hir_ty/src/autoderef.rs +++ b/crates/ra_hir_ty/src/autoderef.rs @@ -20,7 +20,7 @@ use crate::{ const AUTODEREF_RECURSION_LIMIT: usize = 10; pub fn autoderef<'a>( - db: &'a impl HirDatabase, + db: &'a dyn HirDatabase, krate: Option, ty: InEnvironment>, ) -> impl Iterator> + 'a { @@ -32,7 +32,7 @@ pub fn autoderef<'a>( } pub(crate) fn deref( - db: &impl HirDatabase, + db: &dyn HirDatabase, krate: CrateId, ty: InEnvironment<&Canonical>, ) -> Option> { @@ -44,7 +44,7 @@ pub(crate) fn deref( } fn deref_by_trait( - db: &impl HirDatabase, + db: &dyn HirDatabase, krate: CrateId, ty: InEnvironment<&Canonical>, ) -> Option> { @@ -54,7 +54,7 @@ fn deref_by_trait( }; let target = db.trait_data(deref_trait).associated_type_by_name(&name![Target])?; - let generic_params = generics(db, target.into()); + let generic_params = generics(db.upcast(), target.into()); if generic_params.len() != 1 { // the Target type + Deref trait should only have one generic parameter, // namely Deref's Self type -- cgit v1.2.3