Skip to content

Regression affecting static-init versions 1.0.1-1.0.3: "failed to resolve: use of unresolved module or unlinked crate parking_lot" #150646

Open

Description

@theemathas
[INFO] [stdout] error[E0433]: failed to resolve: use of unresolved module or unlinked crate `parking_lot`
[INFO] [stdout]    --> /opt/rustwide/cargo-home/registry/src/index.crates.io-1949cf8c6b5b557f/static_init-1.0.3/src/lazy_sequentializer.rs:336:13
[INFO] [stdout]     |
[INFO] [stdout] 336 |         use parking_lot::lock_api::GetThreadId;
[INFO] [stdout]     |             ^^^^^^^^^^^ use of unresolved module or unlinked crate `parking_lot`
[INFO] [stdout]     |
[INFO] [stdout]     = help: if you wanted to use a crate named `parking_lot`, use `cargo add parking_lot` to add it to your `Cargo.toml`
[INFO] [stdout] 
[INFO] [stdout] 
[INFO] [stdout] error[E0433]: failed to resolve: use of unresolved module or unlinked crate `parking_lot`
[INFO] [stdout]    --> /opt/rustwide/cargo-home/registry/src/index.crates.io-1949cf8c6b5b557f/static_init-1.0.3/src/lazy_sequentializer.rs:371:21
[INFO] [stdout]     |
[INFO] [stdout] 371 |                 use parking_lot::lock_api::GetThreadId;
[INFO] [stdout]     |                     ^^^^^^^^^^^ use of unresolved module or unlinked crate `parking_lot`
[INFO] [stdout]     |
[INFO] [stdout]     = help: if you wanted to use a crate named `parking_lot`, use `cargo add parking_lot` to add it to your `Cargo.toml`
[INFO] [stdout] 
[INFO] [stdout] 
[INFO] [stdout] error[E0433]: failed to resolve: use of unresolved module or unlinked crate `parking_lot`
[INFO] [stdout]    --> /opt/rustwide/cargo-home/registry/src/index.crates.io-1949cf8c6b5b557f/static_init-1.0.3/src/lazy_sequentializer.rs:338:13
[INFO] [stdout]     |
[INFO] [stdout] 338 |             parking_lot::RawThreadId.nonzero_thread_id().into(),
[INFO] [stdout]     |             ^^^^^^^^^^^ use of unresolved module or unlinked crate `parking_lot`
[INFO] [stdout]     |
[INFO] [stdout]     = help: if you wanted to use a crate named `parking_lot`, use `cargo add parking_lot` to add it to your `Cargo.toml`
[INFO] [stdout] 
[INFO] [stdout] 
[INFO] [stdout] error[E0433]: failed to resolve: use of unresolved module or unlinked crate `parking_lot`
[INFO] [stdout]    --> /opt/rustwide/cargo-home/registry/src/index.crates.io-1949cf8c6b5b557f/static_init-1.0.3/src/lazy_sequentializer.rs:372:26
[INFO] [stdout]     |
[INFO] [stdout] 372 |                 if id == parking_lot::RawThreadId.nonzero_thread_id().into() {
[INFO] [stdout]     |                          ^^^^^^^^^^^ use of unresolved module or unlinked crate `parking_lot`
[INFO] [stdout]     |
[INFO] [stdout]     = help: if you wanted to use a crate named `parking_lot`, use `cargo add parking_lot` to add it to your `Cargo.toml`

This regression appears to affect the static-init crate versions 1.0.1-1.0.3, when built with debug_assertions on.

Explanation of the regression (Edit: This explanation is wrong), according to @cuviper, copied from zulip:

  • static-init's feature "debug_order" enables parking-lot
  • the code that uses it is gated on cfg(debug_mode) (not feature)
  • the build script sets cfg "debug_mode" for feature "debug_order" or for debug_assertions, until 1.0.4 removed the latter
  • thus it was trying to use parking-lot in all debug builds until 1.0.4 fixed that

and I think it's clearly the intention of #149273 that they shouldn't have been able to use parking-lot implicitly before

Activity

  1. added
    C-bugCategory: This is a bug.
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    on Jan 3, 2026
  2. added
    I-prioritizeIssue needs a team member to assess the impact. Will be replaced by P-{low,medium,high,critical}
    on Jan 3, 2026
  3. changed the title [-]Regression affecting `static-init` version 1.0.3 or earlier: "failed to resolve: use of unresolved module or unlinked crate `parking_lot`"[/-] [+]Regression affecting `static-init` version 1.0.1-1.0.3: "failed to resolve: use of unresolved module or unlinked crate `parking_lot`"[/+] on Jan 3, 2026
  4. changed the title [-]Regression affecting `static-init` version 1.0.1-1.0.3: "failed to resolve: use of unresolved module or unlinked crate `parking_lot`"[/-] [+]Regression affecting `static-init` versions 1.0.1-1.0.3: "failed to resolve: use of unresolved module or unlinked crate `parking_lot`"[/+] on Jan 3, 2026
  5. apiraino commented on Jan 3, 2026

    @apiraino
  6. bjorn3 commented on Jan 3, 2026

    @bjorn3
  7. theemathas commented on Jan 3, 2026

    @theemathas
    ContributorAuthor

    (Note: The regression reproduces on Linux, but not Windows.)

    Result of running cargo bisect-rustc --start=1.92.0 --end=beta on an empty crate with a dependency of static_init = "=1.0.3":

    searched toolchains 6501e64fcb02d22b49d6e59d10a7692ec8095619 through 66428d92bec337ed4785d695d0127276a482278c
    
    
    ********************************************************************************
    Regression in ea98522531eec51ee51c393ea4a79af36469d696
    ********************************************************************************
    
    Attempting to search unrolled perf builds
    adding local env GITHUB_TOKEN value to headers in github query
    adding local env GITHUB_TOKEN value to headers in github query
    ERROR: couldn't find perf build comment
    

    Turns out that the regression actually occurred in #149199. Sorry for the confusion.

  8. added
    T-cargoRelevant to the cargo team, which will review and decide on the PR/issue.
    on Jan 3, 2026
  9. theemathas commented on Jan 3, 2026

    @theemathas
    Author
  10. theemathas commented on Jan 3, 2026

    @theemathas
    Author
  11. added
    E-needs-mcveCall for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example
    and removed
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    on Jan 3, 2026
  12. 11 remaining items

  13. removed
    E-needs-mcveCall for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example
    on Jan 7, 2026
  14. theemathas commented on Jan 7, 2026

    @theemathas
    ContributorAuthor

    To summarize the situation:

    • static-init versions 1.0.1-1.0.3 tried to detect if the crate was compiled with cfg(debug_assertions) on, and do conditional compilation based on that. However, the conditionally-compiled code had a bug: If cfg(debug_assertions) was detected to be on, code in static-init would attempt to import parking_lot without actually having it as a dependency.
      • This bug was fixed in static-init version 1.0.4
    • static-init versions 1.0.1-1.0.3 were depending on cfg_aliases version 0.1 to check the cfg conditions. The cfg_aliases crate attempts to do this by checking if the CARGO_CFG_DEBUG_ASSERTIONS env var was set.
      • cfg_aliases version 0.2.0 starting also checking the PROFILE env var in addition to CARGO_CFG_DEBUG_ASSERTIONS env var, working around the bug below.
    • Due to a bug in cargo (Allow build scripts to detect debug_assertions setting cargo#15760), cargo previously didn't set the CARGO_CFG_DEBUG_ASSERTIONS env var in any situation. This causes cfg_aliases version 0.1 to think that cfg(debug_assertions) was not set. Which then causes bug in static-init versions 1.0.1-1.0.3 to not happen.
    • The above bug was fixed in Enable CARGO_CFG_DEBUG_ASSERTIONS in build scripts based on profile cargo#16160. This causes cfg_aliases version 0.1 to start correctly detecting cfg(debug_assertions), which triggered the bug in static-init versions 1.0.1-1.0.3, which means that static-init versions 1.0.1-1.0.3 will stop compiling in rust 1.93.0.
  15. removed
    I-prioritizeIssue needs a team member to assess the impact. Will be replaced by P-{low,medium,high,critical}
    on Jan 8, 2026
  16. added this to the 1.93.0 milestone on Jan 16, 2026
  17. added
    relnotesMarks issues that should be documented in the release notes of the next release.
    and removed
    relnotesMarks issues that should be documented in the release notes of the next release.
    on Jan 16, 2026
  18. added a commit that references this issue on Jan 17, 2026
  19. added a commit that references this issue on Jan 23, 2026
  20. added
    regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.
    and removed on Feb 27, 2026
  21. added
    I-prioritizeIssue needs a team member to assess the impact. Will be replaced by P-{low,medium,high,critical}
    on Feb 27, 2026
  22. removed
    I-prioritizeIssue needs a team member to assess the impact. Will be replaced by P-{low,medium,high,critical}
    on Mar 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.S-has-bisectionStatus: A bisection has been found for this issueT-cargoRelevant to the cargo team, which will review and decide on the PR/issue.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.relnotesMarks issues that should be documented in the release notes of the next release.

    Type

    No type

    Projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions