feat: Visualize compiler inserted reborrows via inlay hints
This commit is contained in:
@@ -8,6 +8,7 @@ use base_db::{FileId, FileRange};
|
||||
use hir_def::{
|
||||
body, macro_id_to_def_id,
|
||||
resolver::{self, HasResolver, Resolver, TypeNs},
|
||||
type_ref::Mutability,
|
||||
AsMacroCall, FunctionId, MacroId, TraitId, VariantId,
|
||||
};
|
||||
use hir_expand::{
|
||||
@@ -313,6 +314,11 @@ impl<'db, DB: HirDatabase> Semantics<'db, DB> {
|
||||
self.imp.resolve_type(ty)
|
||||
}
|
||||
|
||||
// FIXME: Figure out a nice interface to inspect adjustments
|
||||
pub fn is_implicit_reborrow(&self, expr: &ast::Expr) -> Option<Mutability> {
|
||||
self.imp.is_implicit_reborrow(expr)
|
||||
}
|
||||
|
||||
pub fn type_of_expr(&self, expr: &ast::Expr) -> Option<TypeInfo> {
|
||||
self.imp.type_of_expr(expr)
|
||||
}
|
||||
@@ -900,6 +906,10 @@ impl<'db> SemanticsImpl<'db> {
|
||||
Type::new_with_resolver(self.db, &scope.resolver, ty)
|
||||
}
|
||||
|
||||
fn is_implicit_reborrow(&self, expr: &ast::Expr) -> Option<Mutability> {
|
||||
self.analyze(expr.syntax()).is_implicit_reborrow(self.db, expr)
|
||||
}
|
||||
|
||||
fn type_of_expr(&self, expr: &ast::Expr) -> Option<TypeInfo> {
|
||||
self.analyze(expr.syntax())
|
||||
.type_of_expr(self.db, expr)
|
||||
|
||||
Reference in New Issue
Block a user