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

rustc crash with [dashmap](https://crates.io/crates/dashmap) #128975

Closed
misaka10987 opened this issue Aug 11, 2024 · 2 comments
Closed

rustc crash with [dashmap](https://crates.io/crates/dashmap) #128975

misaka10987 opened this issue Aug 11, 2024 · 2 comments
Labels
C-bug Category: This is a bug. 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

@misaka10987
Copy link

Code

Triggered by the third-party library dashmap.
src/lib.rs:

use dashmap::DashMap;

#[derive(PartialEq, Eq, Clone, Copy, Hash)]
pub struct Id(pub &'static str);

fn f(x: DashMap<Id, ()>) {
    let id = Id("key");
    x.view(&id, |k, _| k);
}

Cargo.toml

[package]
name = "crash"
version = "0.1.0"
edition = "2021"

[dependencies]
dashmap = "6.0.1"

Meta

rustc --version --verbose:

rustc 1.80.0 (051478957 2024-07-21) (Arch Linux rust 1:1.80.0-1)
binary: rustc
commit-hash: 051478957371ee0084a7c0913941d2a8c4757bb9
commit-date: 2024-07-21
host: x86_64-unknown-linux-gnu
release: 1.80.0
LLVM version: 18.1.8

Error output

error: internal compiler error: RegionError { fr_origin: FreeRegion, longer_fr: '?2, shorter_fr: '?1, is_reported: true }
  |
  = note: delayed at compiler/rustc_borrowck/src/region_infer/mod.rs:1607:31 - disabled backtrace

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: rustc 1.80.0 (051478957 2024-07-21) (Arch Linux rust 1:1.80.0-1) running on x86_64-unknown-linux-gnu

note: compiler flags: --crate-type lib -C embed-bitcode=no -C debuginfo=2 -C incremental=[REDACTED]

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
end of query stack
thread 'rustc' panicked at library/core/src/panicking.rs:227: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: rustc 1.80.0 (051478957 2024-07-21) (Arch Linux rust 1:1.80.0-1) running on x86_64-unknown-linux-gnu

note: compiler flags: --crate-type lib -C embed-bitcode=no -C debuginfo=2 -C incremental=[REDACTED]

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
end of query stack
thread caused non-unwinding panic. aborting.
Backtrace

stack backtrace:
   0:     0x7f8ecaf4f135 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hdd9ab9b10a59d94d
   1:     0x7f8ecaf9db1b - core::fmt::write::h223fabb34786078a
   2:     0x7f8ecaf4421f - <unknown>
   3:     0x7f8ecaf4ef0e - <unknown>
   4:     0x7f8ecaf51949 - <unknown>
   5:     0x7f8ecaf516ea - std::panicking::default_hook::h2d74591a472105ec
   6:     0x7f8ecb85c21d - <unknown>
   7:     0x7f8ecaf5200b - std::panicking::rust_panic_with_hook::h1d32f519fa4e3a41
   8:     0x7f8ecaf51d84 - <unknown>
   9:     0x7f8ecaf4f5f9 - <unknown>
  10:     0x7f8ecaf51ab7 - rust_begin_unwind
  11:     0x7f8ecaf15a63 - core::panicking::panic_fmt::h3e309476ae0f7f32
  12:     0x7f8ecb775dcd - <unknown>
  13:     0x7f8ece10142d - <unknown>
  14:     0x7f8ece0958ab - <unknown>
  15:     0x7f8ece095088 - <unknown>
  16:     0x7f8ece1b2939 - <unknown>
  17:     0x7f8ece1afbcb - <unknown>
  18:     0x7f8ece1afb3a - <unknown>
  19:     0x7f8ece1a8665 - <rustc_middle[c2835b22a69ac0b4]::ty::generics::GenericPredicates>::instantiate
  20:     0x7f8ecc510283 - <unknown>
  21:     0x7f8ecc50cd94 - <unknown>
  22:     0x7f8ecc521d6f - <unknown>
  23:     0x7f8ecc515509 - rustc_borrowck[ece6d9bbde3e5003]::mir_borrowck
  24:     0x7f8eccde966f - <unknown>
  25:     0x7f8eccf6addc - <unknown>
  26:     0x7f8ecd0903dc - <unknown>
  27:     0x7f8ecce8f425 - <unknown>
  28:     0x7f8ecc648020 - <unknown>
  29:     0x7f8ecc64db6d - <unknown>
  30:     0x7f8ecc65207e - <unknown>
  31:     0x7f8ecc641157 - <unknown>
  32:     0x7f8ecc6c5cb1 - <unknown>
  33:     0x7f8ecc51fe6a - <unknown>
  34:     0x7f8ecc515509 - rustc_borrowck[ece6d9bbde3e5003]::mir_borrowck
  35:     0x7f8eccde966f - <unknown>
  36:     0x7f8eccf6addc - <unknown>
  37:     0x7f8ecd0903dc - <unknown>
  38:     0x7f8ecce8f425 - <unknown>
  39:     0x7f8ecba9ed4f - <unknown>
  40:     0x7f8ecba6107c - <unknown>
  41:     0x7f8ecba9c01e - <unknown>
  42:     0x7f8ecba3c12d - rustc_interface[bf1d2a955b0fbb76]::passes::analysis
  43:     0x7f8eccded4fd - <unknown>
  44:     0x7f8eccfbad29 - <unknown>
  45:     0x7f8ecd03af4f - <unknown>
  46:     0x7f8ecce7ea14 - <unknown>
  47:     0x7f8ecb865103 - <unknown>
  48:     0x7f8ecb834294 - <unknown>
  49:     0x7f8ecb82424c - <unknown>
  50:     0x7f8ecb833ba2 - <unknown>
  51:     0x7f8ecb859366 - <unknown>
  52:     0x7f8ecb82c658 - <unknown>
  53:     0x7f8ecaf5bfeb - <unknown>
  54:     0x7f8ecad7639d - <unknown>
  55:     0x7f8ecadfb49c - <unknown>
  56:                0x0 - <unknown>

@misaka10987 misaka10987 added C-bug Category: This is a bug. 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 Aug 11, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Aug 11, 2024
@misaka10987
Copy link
Author

Note that the following code does not result a crash:

use dashmap::DashMap;

#[derive(PartialEq, Eq, Clone, Copy, Hash)]
pub struct Id(pub &'static str);

// fn f(x: DashMap<Id, ()>) {
//     let id = Id("key");
//     x.view(&id, |k, _| k);
// }

fn g(x: DashMap<&'static str, ()>) {
    x.view(&"key", |k, _| *k);
}

@compiler-errors
Copy link
Member

Thanks for the report -- this was fixed in #126884, which will be the next Rust release. We don't typically backport ICE fixes from bad error messages unless they're particularly easy to trigger.

@saethlin saethlin removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Aug 11, 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. 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

4 participants