-
Notifications
You must be signed in to change notification settings - Fork 13k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
In a previous PR, an optimization was introduced in the needs drop code to ensure that we recurse through the query system, thereby improving caching and not duplicting work. However, this optimization did not correctly check for possible cycles in doing this. This change introduces that check.
- Loading branch information
1 parent
72e74d7
commit c5b1357
Showing
2 changed files
with
66 additions
and
48 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
13 changes: 13 additions & 0 deletions
13
src/test/ui/closures/2229_closure_analysis/issue-92724-needsdrop-query-cycle.rs
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,13 @@ | ||
// ICEs if checking if there is a significant destructor causes a query cycle | ||
// check-pass | ||
|
||
#![warn(rust_2021_incompatible_closure_captures)] | ||
pub struct Foo(Bar); | ||
pub struct Bar(Vec<Foo>); | ||
|
||
impl Foo { | ||
pub fn bar(self, v: Bar) -> Bar { | ||
(|| v)() | ||
} | ||
} | ||
fn main() {} |