diff options
Diffstat (limited to 'crates/ra_hir/src/ty')
-rw-r--r-- | crates/ra_hir/src/ty/autoderef.rs | 4 | ||||
-rw-r--r-- | crates/ra_hir/src/ty/tests.rs | 1 | ||||
-rw-r--r-- | crates/ra_hir/src/ty/traits.rs | 2 |
3 files changed, 4 insertions, 3 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( |
diff --git a/crates/ra_hir/src/ty/tests.rs b/crates/ra_hir/src/ty/tests.rs index 059a73900..7a101d981 100644 --- a/crates/ra_hir/src/ty/tests.rs +++ b/crates/ra_hir/src/ty/tests.rs | |||
@@ -2768,7 +2768,6 @@ fn test(s: Arc<S>) { | |||
2768 | 2768 | ||
2769 | #[test] | 2769 | #[test] |
2770 | fn deref_trait_with_inference_var() { | 2770 | fn deref_trait_with_inference_var() { |
2771 | // std::env::set_var("RUST_BACKTRACE", "1"); | ||
2772 | let t = type_at( | 2771 | let t = type_at( |
2773 | r#" | 2772 | r#" |
2774 | //- /main.rs | 2773 | //- /main.rs |
diff --git a/crates/ra_hir/src/ty/traits.rs b/crates/ra_hir/src/ty/traits.rs index 6cf3dd70a..9a6349d4b 100644 --- a/crates/ra_hir/src/ty/traits.rs +++ b/crates/ra_hir/src/ty/traits.rs | |||
@@ -105,7 +105,7 @@ pub(crate) fn implements_query( | |||
105 | solution.map(|solution| solution_from_chalk(db, solution)) | 105 | solution.map(|solution| solution_from_chalk(db, solution)) |
106 | } | 106 | } |
107 | 107 | ||
108 | pub(crate) fn normalize( | 108 | pub(crate) fn normalize_query( |
109 | db: &impl HirDatabase, | 109 | db: &impl HirDatabase, |
110 | krate: Crate, | 110 | krate: Crate, |
111 | projection: Canonical<ProjectionPredicate>, | 111 | projection: Canonical<ProjectionPredicate>, |