Skip to content

Unresolved imports when building std without thread local #127773

Closed
@xTachyon

Description

@xTachyon

Doing the following:

rustc --print target-spec-json --target aarch64-apple-darwin -Z unstable-options > t.json
change is-builtin and has-thread-local to false in the json
cargo b -Z build-std=std,core,panic_unwind --target t.json

I expected to see this happen: it compiles

Instead, this happened:

error[E0432]: unresolved imports `crate::sys::thread_local::key::get`, `crate::sys::thread_local::key::set`, `crate::sys::thread_local::key::Key`, `crate::sys::thread_local::key::LazyKey`
 --> /Users/x/.rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/sys/thread_local/os.rs:5:37
  |
5 | use crate::sys::thread_local::key::{get, set, Key, LazyKey};
  |                                     ^^^  ^^^  ^^^  ^^^^^^^ no `LazyKey` in `sys::thread_local::key`
  |                                     |    |    |
  |                                     |    |    no `Key` in `sys::thread_local::key`
  |                                     |    no `set` in `sys::thread_local::key`
  |                                     no `get` in `sys::thread_local::key`
  |
note: module `crate::collections::hash::set` exists but is inaccessible
 --> /Users/x/.rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/collections/hash/mod.rs:4:1
  |
4 | pub mod set;
  | ^^^^^^^^^^^^ not accessible

This used to work on nightly versions from last year.

Meta

rustc --version --verbose:

rustc 1.81.0-nightly (d9284afea 2024-07-14)
binary: rustc
commit-hash: d9284afea99e0969a0e692b9e9fd61ea4ba21366
commit-date: 2024-07-14
host: aarch64-apple-darwin
release: 1.81.0-nightly
LLVM version: 18.1.7

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-thread-localsArea: Thread local storage (TLS)C-bugCategory: This is a bug.T-libsRelevant to the library team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions