mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-30 13:51:31 +00:00
Implement IntoFuture type inference
This commit is contained in:
parent
3792720086
commit
5810c8188a
9 changed files with 75 additions and 22 deletions
|
@ -2780,6 +2780,8 @@ impl Type {
|
|||
/// Checks that particular type `ty` implements `std::future::Future`.
|
||||
/// This function is used in `.await` syntax completion.
|
||||
pub fn impls_future(&self, db: &dyn HirDatabase) -> bool {
|
||||
// FIXME: This should be checking for IntoFuture trait, but I don't know how to find the
|
||||
// right TraitId in this crate.
|
||||
let std_future_trait = db
|
||||
.lang_item(self.env.krate, SmolStr::new_inline("future_trait"))
|
||||
.and_then(|it| it.as_trait());
|
||||
|
|
|
@ -269,6 +269,8 @@ impl SourceAnalyzer {
|
|||
db: &dyn HirDatabase,
|
||||
await_expr: &ast::AwaitExpr,
|
||||
) -> Option<FunctionId> {
|
||||
// FIXME This should be pointing to the poll of IntoFuture::Output's Future impl, but I
|
||||
// don't know how to resolve the Output type so that we can query for its poll method.
|
||||
let ty = self.ty_of_expr(db, &await_expr.expr()?.into())?;
|
||||
|
||||
let op_fn = db
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue