forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of rust-lang#93449 - JakobDegen:restrict-hasdrop-optimizat…
…ion, r=cjgillot Restrict query recursion in `needs_significant_drop` Overly aggressive use of the query system to improve caching lead to query cycles and consequently ICEs. This patch fixes this by restricting the use of the query system as a cache to those cases where it is definitely correct. Closes rust-lang#92725 . This is essentially a revert of rust-lang#90845 for the significant drop case only. The general `needs_drop` still does the same thing. The hope is that this is enough to preserve the performance improvements of that PR while fixing the ICE. Should get a perf run to verify that this is the case. cc `@cjgillot`
- Loading branch information
Showing
2 changed files
with
31 additions
and
19 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
14 changes: 14 additions & 0 deletions
14
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,14 @@ | ||
// 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(Baz); | ||
pub struct Baz(Vec<Foo>); | ||
|
||
impl Foo { | ||
pub fn baz(self, v: Baz) -> Baz { | ||
(|| v)() | ||
} | ||
} | ||
fn main() {} |