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

ICE: panic in a destructor during cleanup #131298

Open
matthiaskrgr opened this issue Oct 5, 2024 · 2 comments
Open

ICE: panic in a destructor during cleanup #131298

matthiaskrgr opened this issue Oct 5, 2024 · 2 comments
Labels
C-bug Category: This is a bug. F-type_alias_impl_trait `#[feature(type_alias_impl_trait)]` I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ S-bug-has-test Status: This bug is tracked inside the repo by a `known-bug` test. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@matthiaskrgr
Copy link
Member

Code

#![feature(type_alias_impl_trait)]

trait Trait {
    type Gat<'lt>;
}

fn dyn_hoops<T: Trait>(_: T) -> *const dyn for<'b> Iterator<Item = impl Sized + Captures<'a>> {
    loop {}
}

mod typeck {
    use super::*;
    type Opaque = impl Sized;
    fn define() -> Option<Opaque> {
        let _: Opaque = dyn_hoops::<u8>(0);
        None
    }
}

fn main() {}

Meta

rustc --version --verbose:

rustc 1.83.0-nightly (f559d6188 2024-10-05)
binary: rustc
commit-hash: f559d6188828b738ce7e7c2e4d99bf03111336d6
commit-date: 2024-10-05
host: x86_64-unknown-linux-gnu
release: 1.83.0-nightly
LLVM version: 19.1.0

Error output

<output>
Backtrace

error[E0261]: use of undeclared lifetime name `'a`
 --> a.rs:7:90
  |
7 | fn dyn_hoops<T: Trait>(_: T) -> *const dyn for<'b> Iterator<Item = impl Sized + Captures<'a>> {
  |                                                                                          ^^ undeclared lifetime
  |
  = note: for more information on higher-ranked polymorphism, visit https://doc.rust-lang.org/nomicon/hrtb.html
help: consider making the bound lifetime-generic with a new `'a` lifetime
  |
7 | fn dyn_hoops<T: Trait>(_: T) -> *const dyn for<'b> Iterator<Item = impl Sized + for<'a> Captures<'a>> {
  |                                                                                 +++++++
help: consider making the bound lifetime-generic with a new `'a` lifetime
  |
7 | fn dyn_hoops<T: Trait>(_: T) -> *const dyn for<'a, 'b> Iterator<Item = impl Sized + Captures<'a>> {
  |                                                +++
help: consider introducing lifetime `'a` here
  |
7 | fn dyn_hoops<'a, T: Trait>(_: T) -> *const dyn for<'b> Iterator<Item = impl Sized + Captures<'a>> {
  |              +++

error[E0405]: cannot find trait `Captures` in this scope
 --> a.rs:7:81
  |
7 | fn dyn_hoops<T: Trait>(_: T) -> *const dyn for<'b> Iterator<Item = impl Sized + Captures<'a>> {
  |                                                                                 ^^^^^^^^ not found in this scope

thread 'rustc' panicked at core/src/panicking.rs:229:5:
panic in a destructor during cleanup

error: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: please make sure that you have updated to the latest nightly

note: please attach the file at `/tmp/im/rustc-ice-2024-10-05T15_12_11-2721517.txt` to your bug report

query stack during panic:
#0 [typeck] type-checking `typeck::define`
#1 [type_of_opaque] computing type of opaque `typeck::Opaque::{opaque#0}`
#2 [type_of] computing type of `typeck::Opaque::{opaque#0}`
#3 [check_well_formed] checking that `typeck::Opaque::{opaque#0}` is well-formed
#4 [check_mod_type_wf] checking that types are well-formed in module `typeck`
#5 [analysis] running analysis passes on this crate
end of query stack
thread caused non-unwinding panic. aborting.

@matthiaskrgr matthiaskrgr added C-bug Category: This is a bug. F-type_alias_impl_trait `#[feature(type_alias_impl_trait)]` I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Oct 5, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Oct 5, 2024
@cyrgani
Copy link
Contributor

cyrgani commented Oct 5, 2024

Reduced:

fn dyn_hoops<T>() -> *const dyn Iterator<Item = impl Captures> {
    loop {}
}

mod typeck {
    type Opaque = impl Sized;
    fn define() -> Opaque {
        let _: Opaque = super::dyn_hoops::<u8>();
    }
}

@matthiaskrgr
Copy link
Member Author

bisects to #125001

@matthiaskrgr matthiaskrgr added the S-bug-has-test Status: This bug is tracked inside the repo by a `known-bug` test. label Oct 12, 2024
@saethlin saethlin removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Oct 15, 2024
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. F-type_alias_impl_trait `#[feature(type_alias_impl_trait)]` I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ S-bug-has-test Status: This bug is tracked inside the repo by a `known-bug` test. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

4 participants