-
Notifications
You must be signed in to change notification settings - Fork 12.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of #65936 - Xanewok:save-analysis-async, r=nikomatsakis
save-analysis: Account for async desugaring in async fn return types Closes #65590 When visiting the return type of an async function we need to take into account its desugaring, since it introduces a new definition under which the return type is redefined. r? @nikomatsakis
- Loading branch information
Showing
2 changed files
with
44 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// check-pass | ||
// compile-flags: -Zsave-analysis | ||
// edition:2018 | ||
|
||
// Async desugaring for return types in (associated) functions introduces a | ||
// separate definition internally, which we need to take into account | ||
// (or else we ICE). | ||
trait Trait { type Assoc; } | ||
struct Struct; | ||
|
||
async fn foobar<T: Trait>() -> T::Assoc { | ||
unimplemented!() | ||
} | ||
|
||
impl Struct { | ||
async fn foo<T: Trait>(&self) -> T::Assoc { | ||
unimplemented!() | ||
} | ||
} | ||
|
||
fn main() {} |