-
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.
inliner: Avoid query cycles when optimizing generators
The HIR Id trick is insufficient to prevent query cycles when optimizing generators, since merely requesting a layout of a generator also computes its `optimized_mir`. Make no attempts to inline functions into generators within the same crate to avoid query cycles.
- Loading branch information
Showing
2 changed files
with
26 additions
and
2 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,18 @@ | ||
// Checks that inliner doesn't introduce cycles when optimizing generators. | ||
// The outcome of optimization is not verfied, just the absence of the cycle. | ||
// Regression test for #76181. | ||
// | ||
// edition:2018 | ||
|
||
#![crate_type = "lib"] | ||
|
||
pub struct S; | ||
|
||
impl S { | ||
pub async fn g(&mut self) { | ||
self.h(); | ||
} | ||
pub fn h(&mut self) { | ||
let _ = self.g(); | ||
} | ||
} |