Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error[E0391] cycle detected when computing when using rust_2021_incompatible_closure_captures #92725

Closed
zheland opened this issue Jan 10, 2022 · 4 comments · Fixed by #93449
Closed
Assignees
Labels
C-bug Category: This is a bug. P-high High priority regression-from-stable-to-stable Performance or correctness regression from one stable version to another. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@zheland
Copy link

zheland commented Jan 10, 2022

Summary

Error error[E0391] cycle detected when computing when Bar has a significant destructor occurs
when warn/deny rust_2021_incompatible_closure_captures lint on rust beta and nightly with a certain code snippet.
On rust stable, it compiles without any issues. Looks like an issue of rustc (rust-lang/rust-clippy#8258 (comment)).

Code

I tried this code:

#![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)()
    }
}

It compiles successfully on stable or with #![allow(rust_2021_incompatible_closure_captures)]:

    Finished dev [optimized + debuginfo] target(s)

But with this lint warned (or denied) it does not compile on rust beta and on rust nightly with error:

error[E0391]: cycle detected when computing when `Bar` has a significant destructor
 --> src/lib.rs:3:1
  |
3 | pub struct Bar(Vec<Foo>);
  | ^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: ...which immediately requires computing when `Bar` has a significant destructor again
  = note: cycle used when computing whether `Bar` has a significant drop

Version it worked on

rustc +stable -vV:

rustc 1.57.0 (f1edd0429 2021-11-29)
binary: rustc
commit-hash: f1edd0429582dd29cccacaf50fd134b05593bd9c
commit-date: 2021-11-29
host: x86_64-unknown-linux-gnu
release: 1.57.0
LLVM version: 13.0.0

Version with regression

rustc +beta --version --verbose:

rustc 1.58.0-beta.3 (4aa9d237c 2022-01-08)
binary: rustc
commit-hash: 4aa9d237c7254fc4829cfea2a27d9896b18cdbc1
commit-date: 2022-01-08
host: x86_64-unknown-linux-gnu
release: 1.58.0-beta.3
LLVM version: 13.0.0

rustc +nightly --version --verbose

rustc 1.60.0-nightly (092e1c9d2 2022-01-09)
binary: rustc
commit-hash: 092e1c9d23158d81be27bb6f71bdd0c6282478fb
commit-date: 2022-01-09
host: x86_64-unknown-linux-gnu
release: 1.60.0-nightly
LLVM version: 13.0.0
@zheland zheland added C-bug Category: This is a bug. regression-untriaged Untriaged performance or correctness regression. labels Jan 10, 2022
@rustbot rustbot added the I-prioritize Issue: Indicates that prioritization has been requested for this issue. label Jan 10, 2022
@inquisitivecrystal
Copy link
Contributor

inquisitivecrystal commented Jan 11, 2022

Bisects to #90845, CC @JakobDegen.

Although this is a regression from stable to beta, there's not enough time for it to get fixed before release.

@inquisitivecrystal inquisitivecrystal added regression-from-stable-to-beta Performance or correctness regression from stable to beta. and removed regression-untriaged Untriaged performance or correctness regression. labels Jan 11, 2022
@JakobDegen
Copy link
Contributor

Oops. Yeah, i read the error message and immediately knew what was going on. I can hopefully get a patch up for this tomorrow.

@rustbot claim

@apiraino apiraino added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Jan 13, 2022
@rustbot rustbot added P-critical Critical priority and removed I-prioritize Issue: Indicates that prioritization has been requested for this issue. labels Jan 13, 2022
@apiraino apiraino added I-prioritize Issue: Indicates that prioritization has been requested for this issue. and removed P-critical Critical priority labels Jan 13, 2022
@steffahn
Copy link
Member

@rustbot label regression-from-stable-to-stable, -regression-from-stable-to-beta

@rustbot rustbot added regression-from-stable-to-stable Performance or correctness regression from one stable version to another. and removed regression-from-stable-to-beta Performance or correctness regression from stable to beta. labels Jan 19, 2022
@apiraino
Copy link
Contributor

Assigning priority as discussed in the Zulip thread of the Prioritization Working Group.

@rustbot label -I-prioritize +P-high

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. P-high High priority regression-from-stable-to-stable Performance or correctness regression from one stable version to another. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
6 participants