aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/ty/autoderef.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir/src/ty/autoderef.rs')
-rw-r--r--crates/ra_hir/src/ty/autoderef.rs4
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};
10use crate::{HirDatabase, Name, Resolver, HasGenericParams}; 10use crate::{HirDatabase, Name, Resolver, HasGenericParams};
11use super::{traits::Solution, Ty, Canonical}; 11use super::{traits::Solution, Ty, Canonical};
12 12
13const AUTODEREF_RECURSION_LIMIT: usize = 10;
14
13pub(crate) fn autoderef<'a>( 15pub(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
21pub(crate) fn deref( 23pub(crate) fn deref(