diff options
Diffstat (limited to 'crates/ra_hir/src/ty/autoderef.rs')
-rw-r--r-- | crates/ra_hir/src/ty/autoderef.rs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/crates/ra_hir/src/ty/autoderef.rs b/crates/ra_hir/src/ty/autoderef.rs index e85e558b2..1f443d49b 100644 --- a/crates/ra_hir/src/ty/autoderef.rs +++ b/crates/ra_hir/src/ty/autoderef.rs | |||
@@ -10,12 +10,14 @@ use log::{info, warn}; | |||
10 | use crate::{HirDatabase, Name, Resolver, HasGenericParams}; | 10 | use crate::{HirDatabase, Name, Resolver, HasGenericParams}; |
11 | use super::{traits::Solution, Ty, Canonical}; | 11 | use super::{traits::Solution, Ty, Canonical}; |
12 | 12 | ||
13 | const AUTODEREF_RECURSION_LIMIT: usize = 10; | ||
14 | |||
13 | pub(crate) fn autoderef<'a>( | 15 | pub(crate) fn autoderef<'a>( |
14 | db: &'a impl HirDatabase, | 16 | db: &'a impl HirDatabase, |
15 | resolver: &'a Resolver, | 17 | resolver: &'a Resolver, |
16 | ty: Canonical<Ty>, | 18 | ty: Canonical<Ty>, |
17 | ) -> impl Iterator<Item = Canonical<Ty>> + 'a { | 19 | ) -> impl Iterator<Item = Canonical<Ty>> + 'a { |
18 | successors(Some(ty), move |ty| deref(db, resolver, ty)) | 20 | successors(Some(ty), move |ty| deref(db, resolver, ty)).take(AUTODEREF_RECURSION_LIMIT) |
19 | } | 21 | } |
20 | 22 | ||
21 | pub(crate) fn deref( | 23 | pub(crate) fn deref( |