Repository navigation
Open
Labels
C-bugCategory: This is a bug.Category: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️O-androidOperating system: AndroidOperating system: AndroidO-termuxOperating System: Termux on Android, usually referring to host toolsOperating System: Termux on Android, usually referring to host toolsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.Relevant to the rustdoc team, which will review and decide on the PR/issue.
Description
The panic happens when i run cargo test after the regular test when starting doc tests
Code
see https://github.com/franklaranja/ratatui-garnish/
Meta
This happens on android (termux) tests ok on github. I can only run stable on android
rustc 1.90.0 (1159e78 2025-09-14) (built from a source tarball)
binary: rustc
commit-hash: 1159e78
commit-date: 2025-09-14
host: aarch64-linux-android
release: 1.90.0
LLVM version: 20.1.8
Error output
Doc-tests ratatui_garnish
thread 'rustc' panicked at /home/runner/.termux-build/rust/src/compiler/rustc_data_structures/src/sync/worker_local.rs:28:51:
Unable to verify registry association
stack backtrace:
0: 0x7a8a46b4f4 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::hc3639b3aa7cfc006
1: 0x7a8a4e7bd8 - core::fmt::write::h9abcbe2e3b8912c5
2: 0x7a8a496948 - <unknown>
3: 0x7a8a46b3a8 - <unknown>
4: 0x7a8a49c5e0 - <unknown>
5: 0x7a8a49c438 - std::panicking::default_hook::h6d511e236e3ee8d0
6: 0x7a87434868 - <unknown>
7: 0x7a8a49d008 - std::panicking::rust_panic_with_hook::hb74822548ee3fb9b
8: 0x7a8a46bfa8 - <unknown>
9: 0x7a8a46b9d4 - <unknown>
10: 0x7a8a49ca4c - __rustc[5affb39ba3b5f18]::rust_begin_unwind
11: 0x7a8a4e640c - core::panicking::panic_fmt::h085f52b3d2bd7b4f
12: 0x7a89e17474 - rustc_data_structures[6ea44ddc89345541]::outline::<<rustc_data_structures[6ea44ddc89345541]::sync::worker_local::RegistryId>::verify::{closure#1}, usize>
13: 0x564c962264 - <unknown>
14: 0x564c9304b0 - <unknown>
15: 0x564c6c8ba4 - <unknown>
16: 0x564c6800a0 - <unknown>
17: 0x564c6cf61c - <unknown>
18: 0x7a8a4862f4 - <unknown>
19: 0x7a8abc3a70 - _ZL15__pthread_startPv
20: 0x7a8ab646e8 - __start_thread
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-rustdoc&template=ice.md
note: rustc 1.90.0 (1159e78c4 2025-09-14) (built from a source tarball) running on aarch64-linux-android
note: compiler flags: --crate-type lib -C embed-bitcode=no
query stack during panic:
end of query stack
error: doctest failed, to rerun pass `--doc`
with backtrace set same output
Reacted by XeroOl, Sudip Paudel and Nemris
Metadata
Metadata
Assignees
Labels
C-bugCategory: This is a bug.Category: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️O-androidOperating system: AndroidOperating system: AndroidO-termuxOperating System: Termux on Android, usually referring to host toolsOperating System: Termux on Android, usually referring to host toolsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.Relevant to the rustdoc team, which will review and decide on the PR/issue.
Activity
fmease commentedon Oct 11, 2025
Could you please clarify, what are the exact reproduction steps? Are they:
RUSTFLAGS=-Cembed-bitcode=no cargo testfranklaranja commentedon Oct 14, 2025
That is correct, I run rust within termux, which has its own tust packages
(not rustup). The bug happens when I run cargo test and the testing reaches
doc_tests.
To reproduce in termux:
Noratrieb commentedon Nov 2, 2025
rust/compiler/rustc_data_structures/src/sync/worker_local.rs
Line 28 in bd3ac03
7 remaining items
fmease commentedon Nov 12, 2025
Could somebody that can reproduce this locally run a bisection please? That would be highly appreciated! I'm not sure if https://github.com/rust-lang/cargo-bisect-rustc is gonna help here since y'all's rustc seems to be built from source (
built from a source tarball), so it would probably take too long?Even narrowing it down to a smaller nightly or commit range would be perfect!
fnr1r commentedon Nov 12, 2025
I have never built Rust from source and I have only built one package for Termux, but I have some time so I guess I'll try.
Just from looking at https://github.com/termux/termux-packages/tree/master/packages/rust one patch that might be causing issues is https://github.com/termux/termux-packages/blob/master/packages/rust/0007-use-emulated-tls-on-android.patch (due to being related to TLS) so maybe it's a downstream issue. I haven't ran cargo doc on Termux before (or at least I don't remember it), but that patch is 2 months old (rust 1.90 release) (termux/termux-packages#26733), so it might be it?
Cargo doc and test are also not tested regularly. That might have caught the issue earlier.
I'll comment if I find something more.
fnr1r commentedon Nov 12, 2025
I updated to 1.91.1 and cargo doc now works? Can OP test this version too?
EDIT: Actually, no. It worked only for some packages.
robertkirkman commentedon Nov 26, 2025
I have determined that the downstream patch https://github.com/termux/termux-packages/blob/1c8de6cbfb16473e3e2a7ce7835847846ae1f246/packages/rust/0007-use-emulated-tls-on-android.patch is what causes this error, because applying the patch to Rust 1.89.0, which doesn't normally have this error, causes the error to appear (when
rustdoc --test testdoctest.rsis used on a file like this)However, Rust 1.90.0 and newer don't work on Android if https://github.com/termux/termux-packages/blob/1c8de6cbfb16473e3e2a7ce7835847846ae1f246/packages/rust/0007-use-emulated-tls-on-android.patch is removed, because then
rustchas this other error when attempting to compile anything:I don't know anything else right now, but I might continue trying to look for, for example, the exact commit at which https://github.com/termux/termux-packages/blob/1c8de6cbfb16473e3e2a7ce7835847846ae1f246/packages/rust/0007-use-emulated-tls-on-android.patch becomes required to prevent
fatal runtime error: out of TLS keys, aborting.12101111 commentedon Nov 26, 2025
I also get this error on
aarch64-unknown-linux-ohos.has_thread_local: true+tls_model: TlsModel::Emulatedhas_thread_local: true+tls_model: TlsModel::GeneralDynamic12101111 commentedon Nov 28, 2025
tls-dylib-access.rsis failed on android and ohos target withhas_thread_local: true+tls_model: TlsModel::Emulated.Reproduce it on termux:
Run the test in lldb:
What happend here?
Binary files from termux are stripped, so I use ohos to demonstrate.
__emutls_controlobject and calling__emutls_get_addressfrom binary. The__emutls_controlobject is stored in dylib and exported as a symbol. So binary and dylib will see the same address.__emutls_control->indexis 0 andemutls_init_onceis called.emutls_pthread_keyfrom binary is initialized.__emutls_get_addressfrom dylib is called.__emutls_control->indexis not 0, andemutls_getspecificis called. Butemutls_pthread_keyfrom dylib is 0, sopthread_getspecific(0)is called, which is invalid.How to fix this
When building dylib and cdylib,
__emutls_get_addressshould be a weak exported symbol, when emutls is used.ref:
robertkirkman commentedon Nov 29, 2025
I have bisected the commit where the commands
rustdoc --test testdoctest.rs(of a basic documentation comment) andcargo build(of a hello world) begin to have the errorfatal runtime error: out of TLS keys, abortingon Android. It is this.ad635e5
All commits before that commit (going back to rust 1.89) are able to run
rustdocandcargo buildsuccessfully, and that commit and all commits after that commit are not able to, and have the errorfatal runtime error: out of TLS keys, abortinginstead.The
0007-use-emulated-tls-on-android.patchfixescargo buildafter that commit for the majority of projects, but does not fixrustdoc --test testdoctest.rs, which instead gets the crash reported in the initial comment here, instead offatal runtime error: out of TLS keys, aborting.eggyal commentedon Feb 24, 2026
Regression in #143779 cc @JonathanBrouwer @oli-obk
@rustbot label -E-needs-bisection
kayabaNerve commentedon Feb 24, 2026
Anecdotally, and this isn't the right issue but it's a relevant issue and I want to leave the comment somewhere:
Rust 1.90.0's
rustc, when built withmrustc, also runs out of TLS keys when then used to compile itself on ax86_64-unknown-linux-musltarget (wheremuslalso only offers 128 keys, the only amount required to be present under POSIX standards). That isn't an official way to build Rust, and doesn't appear whenrustc 1.89.0buildsrustc 1.90.0nor whenrustc 1.90.0a built by arustcproper buildsrustc 1.91.1.While Rust 1.90.0, officially, is observed to fail on Android due to TLS issues, Rust 1.90.0 is borderline w.r.t. the amount of keys used for other targets too and can still cause such problems even on other targets if one bumps the table.
JonathanBrouwer commentedon Feb 24, 2026
The PR just slightly increases the amount of threadlocal storage used, because attribute parsers live in thread-local storage. Changing this would be difficult.
robertkirkman commentedon Jul 2, 2026
In Rust version 1.96.0, I'm no longer able to reproduce this issue on my device, even when the
0007-use-emulated-tls-on-android.patchis removed, with any of the tests that could previously reproduce it. This could mean that the issue is no longer reproducible, or it could mean that it is still reproducible, but now requires a different setup that isn't known yet.robertkirkman commentedon Jul 25, 2026
Update: after help from others in the equivalent issue for Haiku, I have again successfully reproduced this error in Android (only when the
0007-use-emulated-tls-on-android.patchcurrently used as a workaround by Termux is removed) using these commands:git clone https://github.com/chitao1234/haiku-tls-key-trigger.git cd haiku-tls-key-trigger cargo build