Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir-ty/src/autoderef.rs')
| -rw-r--r-- | crates/hir-ty/src/autoderef.rs | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/crates/hir-ty/src/autoderef.rs b/crates/hir-ty/src/autoderef.rs index e0e366f450..171ba001c4 100644 --- a/crates/hir-ty/src/autoderef.rs +++ b/crates/hir-ty/src/autoderef.rs @@ -9,7 +9,6 @@ use chalk_ir::cast::Cast; use hir_def::lang_item::LangItem; use hir_expand::name::Name; use intern::sym; -use limit::Limit; use triomphe::Arc; use crate::{ @@ -17,7 +16,7 @@ use crate::{ TraitEnvironment, Ty, TyBuilder, TyKind, }; -static AUTODEREF_RECURSION_LIMIT: Limit = Limit::new(20); +const AUTODEREF_RECURSION_LIMIT: usize = 20; #[derive(Debug)] pub(crate) enum AutoderefKind { @@ -140,7 +139,7 @@ impl<T: TrackAutoderefSteps> Iterator for Autoderef<'_, '_, T> { return Some((self.ty.clone(), 0)); } - if AUTODEREF_RECURSION_LIMIT.check(self.steps.len() + 1).is_err() { + if self.steps.len() > AUTODEREF_RECURSION_LIMIT { return None; } |