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.
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.
- Loading branch information
1 parent
9ecd75b
commit 5952d71
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() {} |