Skip to content

std depends on cfg-if 1.0.0 and 0.1.10  #103365

Closed

Description

@chbaker0

#101861 added cfg-if v1.0.0 as a std dependency.

std still depends on cfg-if v0.1.10:

$ cargo tree -i -p cfg-if@0.1.10
cfg-if v0.1.10
├── getrandom v0.1.14
│   ├── rand v0.7.3
│   │   [dev-dependencies]
│   │   └── std v0.0.0 (/usr/local/google/home/collinbaker/chromium/src/third_party/rust_src/src/library/std)
│   └── rand_core v0.5.1
│       ├── rand v0.7.3 (*)
│       └── rand_chacha v0.2.2
│           └── rand v0.7.3 (*)
├── panic_abort v0.0.0 (/usr/local/google/home/collinbaker/chromium/src/third_party/rust_src/src/library/panic_abort)
│   └── std v0.0.0 (/usr/local/google/home/collinbaker/chromium/src/third_party/rust_src/src/library/std)
└── unwind v0.0.0 (/usr/local/google/home/collinbaker/chromium/src/third_party/rust_src/src/library/unwind)
    └── std v0.0.0 (/usr/local/google/home/collinbaker/chromium/src/third_party/rust_src/src/library/std)

Depending on only one version would be nice. While it's a small library, it's still unnecessary bloat.

Activity

  1. chbaker0 commented on Oct 21, 2022

    @chbaker0
    ContributorAuthor

    @rustbot label T-libs

  2. added
    T-libsRelevant to the library team, which will review and decide on the PR/issue.
    on Oct 21, 2022
  3. thomcc commented on Oct 21, 2022

    @thomcc
    Member

    Note that this bloat is only exposed to users of -Zbuild-std so it doesn't matter much. I'd take a patch removing it from panic_abort and unwind though.

    getrandom should only be used as a dev-dep, and also we can't easily update it for various unfortunate reasons, so I'm not sure how much I'd recommend pushing on that.

  4. chbaker0 commented on Oct 21, 2022

    @chbaker0
    ContributorAuthor

    Note that this bloat is only exposed to users of -Zbuild-std so it doesn't matter much. I'd take a patch removing it from panic_abort and unwind though.

    not exactly true, it's shipped in the normal distribution:

    $ ls .rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib
    libaddr2line-74211b12b443811c.rlib          libmemchr-e89379089032cd0e.rlib             librustc-nightly_rt.tsan.a
    libadler-ce60aba693c46806.rlib              libminiz_oxide-6d1ec8f1337db26d.rlib        librustc_std_workspace_alloc-b113a1d1429de7b6.rlib
    liballoc-c6c03e024a2f1e46.rlib              libobject-4a45f4075ae80a22.rlib             librustc_std_workspace_core-522518611024dce5.rlib
    libcfg_if-a51843dfc5fc8b4b.rlib             libpanic_abort-07057e0406e64bc5.rlib        librustc_std_workspace_std-013cf041d0880b37.rlib
    libcfg_if-fcf994c37af81dc5.rlib             libpanic_unwind-15accacd1251d941.rlib       libstd-7b2106000b625742.rlib
    libcompiler_builtins-b7c79d85cf21a511.rlib  libproc_macro-80378fa4c5002a0d.rlib         libstd-7b2106000b625742.so
    libcore-05898138a596088a.rlib               libprofiler_builtins-f931f59836842a86.rlib  libstd_detect-bb8d1566a1046906.rlib
    libgetopts-55c2848d703ec364.rlib            librustc_demangle-db4d651637ed1365.rlib     libtest-90e69e1db733a8fb.rlib
    libgimli-1f391b051eb3b957.rlib              librustc-nightly_rt.asan.a                  libtest-90e69e1db733a8fb.so
    libhashbrown-1791beb5b36e409b.rlib          librustc-nightly_rt.lsan.a                  libunicode_width-803f21b2ca81a772.rlib
    liblibc-3e961d059b9bcde7.rlib               librustc-nightly_rt.msan.a                  libunwind-757bd6fa410f1121.rlib
    

    Though it is pretty minor.

    getrandom should only be used as a dev-dep, and also we can't easily update it for various unfortunate reasons, so I'm not sure how much I'd recommend pushing on that.

    Locally I was able to update it from 0.1.14 -> 0.1.16, which depends on cfg-if 1.0.0. Will this break in ways I don't understand?

  5. thomcc commented on Oct 21, 2022

    @thomcc
    Member

    not exactly true, it's shipped in the normal distribution

    Good point.

    Locally I was able to update it from 0.1.14 -> 0.1.16, which depends on cfg-if 1.0.0. Will this break in ways I don't understand?

    That's probably be fine. I think the issue is with getrandom 0.2 rather than the 0.1.x series -- whichever one requires wasm_bindgen for the wasm impl and compile_errors when it fails to resolve an impl (since std cannot depend on wasm-bindgen).

    Feel free to r? @thomcc on a PR moving the stdlib to cfg-if v1.x.y.

  6. chbaker0 commented on Oct 21, 2022

    @chbaker0
    ContributorAuthor

    Cool! I put it up for discussion: #103367

  7. added a commit that references this issue on Nov 4, 2022
  8. added a commit that references this issue on Nov 21, 2022
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.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