Skip to content

generic OpaqueCast causes elaborate_drops ICE #116141

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

Closed
lcnr opened this issue Sep 25, 2023 · 2 comments
Closed

generic OpaqueCast causes elaborate_drops ICE #116141

lcnr opened this issue Sep 25, 2023 · 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) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@lcnr
Copy link
Contributor

lcnr commented Sep 25, 2023

#![feature(type_alias_impl_trait)]

fn foo<T>(x: T) {
    type Opaque<T> = impl Sized;
    let foo: Opaque<T> = (x,);
    let (a,): (T,) = foo;
}

fn main() {
    foo::<u32>(1);
}

this should compile, but results in

error: internal compiler error: /rustc/37390d65636dd67e263753a3c04fbc60dcc4348e/compiler/rustc_mir_dataflow/src/elaborate_drops.rs:880:18: open drop from non-ADT `Alias(Opaque, AliasTy { args: [T/#0], def_id: DefId(0:8 ~ playground[3e18]::foo::Opaque::{opaque#0}) })`
 --> src/main.rs:7:1
  |
7 | }
  | ^

thread 'rustc' panicked at /rustc/37390d65636dd67e263753a3c04fbc60dcc4348e/compiler/rustc_errors/src/lib.rs:995:33:
Box<dyn Any>
stack backtrace:
[..]
  16:     0x7f46f718daa6 - std[9ef313c09c7ea29b]::panicking::begin_panic::<rustc_errors[dd5bc5de006c082c]::ExplicitBug>
  17:     0x7f46f71294fe - <rustc_errors[dd5bc5de006c082c]::HandlerInner>::span_bug::<rustc_span[cf885d34b04bf018]::span_encoding::Span, alloc[2953c23748a9424d]::string::String>
  18:     0x7f46f712938b - <rustc_errors[dd5bc5de006c082c]::Handler>::span_bug::<rustc_span[cf885d34b04bf018]::span_encoding::Span, alloc[2953c23748a9424d]::string::String>
  19:     0x7f46f712d9db - rustc_middle[20d02980dd0ade83]::util::bug::opt_span_bug_fmt::<rustc_span[cf885d34b04bf018]::span_encoding::Span>::{closure#0}
  20:     0x7f46f712da0a - rustc_middle[20d02980dd0ade83]::ty::context::tls::with_opt::<rustc_middle[20d02980dd0ade83]::util::bug::opt_span_bug_fmt<rustc_span[cf885d34b04bf018]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  21:     0x7f46f712d2a8 - rustc_middle[20d02980dd0ade83]::ty::context::tls::with_context_opt::<rustc_middle[20d02980dd0ade83]::ty::context::tls::with_opt<rustc_middle[20d02980dd0ade83]::util::bug::opt_span_bug_fmt<rustc_span[cf885d34b04bf018]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  22:     0x7f46f5b47db4 - rustc_middle[20d02980dd0ade83]::util::bug::span_bug_fmt::<rustc_span[cf885d34b04bf018]::span_encoding::Span>
  23:     0x7f46f50ca08e - <rustc_mir_dataflow[6de55ebf20757579]::elaborate_drops::DropCtxt<rustc_mir_transform[9d1f7c219b7f440d]::elaborate_drops::Elaborator>>::elaborate_drop
  24:     0x7f46f50be1f5 - <rustc_mir_transform[9d1f7c219b7f440d]::elaborate_drops::ElaborateDrops as rustc_middle[20d02980dd0ade83]::mir::MirPass>::run_pass
  25:     0x7f46f4d3c01e - rustc_mir_transform[9d1f7c219b7f440d]::mir_drops_elaborated_and_const_checked
  26:     0x7f46f4d3b32e - rustc_query_impl[fcf800a1a0d95cd]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[fcf800a1a0d95cd]::query_impl::mir_drops_elaborated_and_const_checked::dynamic_query::{closure#2}::{closure#0}, rustc_middle[20d02980dd0ade83]::query::erase::Erased<[u8; 8usize]>>
[..]
@lcnr lcnr added 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. C-bug Category: This is a bug. labels Sep 25, 2023
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Sep 25, 2023
@lcnr lcnr changed the title generic OpaqueCast elaborate drops ICE generic OpaqueCast causes elaborate_drops ICE Sep 25, 2023
@lcnr lcnr added F-type_alias_impl_trait `#[feature(type_alias_impl_trait)]` and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Sep 25, 2023
@matthiaskrgr
Copy link
Member

Is this a duplicate of #113594 ?

@lcnr
Copy link
Contributor Author

lcnr commented Sep 25, 2023

closing as dup

@lcnr lcnr closed this as completed Sep 25, 2023
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) ❄️ 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

3 participants