diff options
Diffstat (limited to 'crates/ra_hir/src/source_binder.rs')
-rw-r--r-- | crates/ra_hir/src/source_binder.rs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/crates/ra_hir/src/source_binder.rs b/crates/ra_hir/src/source_binder.rs index 4f9e8c5a9..08e86844d 100644 --- a/crates/ra_hir/src/source_binder.rs +++ b/crates/ra_hir/src/source_binder.rs | |||
@@ -369,6 +369,17 @@ impl SourceAnalyzer { | |||
369 | ) | 369 | ) |
370 | } | 370 | } |
371 | 371 | ||
372 | pub fn autoderef<'a>( | ||
373 | &'a self, | ||
374 | db: &'a impl HirDatabase, | ||
375 | ty: Ty, | ||
376 | ) -> impl Iterator<Item = Ty> + 'a { | ||
377 | // There should be no inference vars in types passed here | ||
378 | // FIXME check that? | ||
379 | let canonical = crate::ty::Canonical { value: ty, num_vars: 0 }; | ||
380 | crate::ty::autoderef(db, &self.resolver, canonical).map(|canonical| canonical.value) | ||
381 | } | ||
382 | |||
372 | #[cfg(test)] | 383 | #[cfg(test)] |
373 | pub(crate) fn body_source_map(&self) -> Arc<BodySourceMap> { | 384 | pub(crate) fn body_source_map(&self) -> Arc<BodySourceMap> { |
374 | self.body_source_map.clone().unwrap() | 385 | self.body_source_map.clone().unwrap() |