Merge #2519
2519: Build correct SourceAnalyzer for traits r=matklad a=matklad Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
This commit is contained in:
commit
ee904594af
@ -62,6 +62,10 @@ fn try_get_resolver_for_node(db: &impl HirDatabase, node: InFile<&SyntaxNode>) -
|
||||
let src = node.with_value(it);
|
||||
Some(ImplBlock::from_source(db, src)?.id.resolver(db))
|
||||
},
|
||||
ast::TraitDef(it) => {
|
||||
let src = node.with_value(it);
|
||||
Some(Trait::from_source(db, src)?.id.resolver(db))
|
||||
},
|
||||
_ => match node.value.kind() {
|
||||
FN_DEF | CONST_DEF | STATIC_DEF => {
|
||||
let def = def_with_body_from_child_node(db, node)?;
|
||||
@ -411,20 +415,6 @@ pub fn iterate_path_candidates<T>(
|
||||
)
|
||||
}
|
||||
|
||||
// pub fn autoderef<'a>(
|
||||
// &'a self,
|
||||
// db: &'a impl HirDatabase,
|
||||
// ty: Ty,
|
||||
// ) -> impl Iterator<Item = Ty> + 'a {
|
||||
// // There should be no inference vars in types passed here
|
||||
// // FIXME check that?
|
||||
// let canonical = Canonical { value: ty, num_vars: 0 };
|
||||
// let krate = self.resolver.krate();
|
||||
// let environment = TraitEnvironment::lower(db, &self.resolver);
|
||||
// let ty = crate::ty::InEnvironment { value: canonical, environment };
|
||||
// crate::ty::autoderef(db, krate, ty).map(|canonical| canonical.value)
|
||||
// }
|
||||
|
||||
/// Checks that particular type `ty` implements `std::future::Future`.
|
||||
/// This function is used in `.await` syntax completion.
|
||||
pub fn impls_future(&self, db: &impl HirDatabase, ty: Type) -> bool {
|
||||
|
Loading…
Reference in New Issue
Block a user