DianaNites/cargo-sysroot

Install `cargo-sysroot` fails

jiangliu opened this issue · 4 comments

root@c235c7e9b6fd:/tdshim# cargo install cargo-sysroot
    Updating `ustc` index
  Installing cargo-sysroot v0.8.0
...
   Compiling cargo-sysroot v0.8.0
error[E0532]: expected tuple struct or tuple variant, found function `Ok`
  --> /root/.cargo/registry/src/mirrors.ustc.edu.cn-61ef6e0cd06fb9b8/cargo-sysroot-0.8.0/src/util.rs:87:12
   |
87 |     if let Ok(to_meta) = to_meta {
   |            ^^ not a tuple struct or tuple variant
   |
help: consider importing one of these items instead
   |
2  | use core::result::Result::Ok;
   |
2  | use std::result::Result::Ok;
   |

error[E0532]: expected tuple struct or tuple variant, found function `Ok`
   --> /root/.cargo/registry/src/mirrors.ustc.edu.cn-61ef6e0cd06fb9b8/cargo-sysroot-0.8.0/src/lib.rs:515:9
    |
515 |         Ok(_) => (),
    |         ^^ not a tuple struct or tuple variant
    |
help: consider importing one of these items instead
    |
4   | use core::result::Result::Ok;
    |
4   | use std::result::Result::Ok;
    |

For more information about this error, try `rustc --explain E0532`.
error: could not compile `cargo-sysroot` due to 2 previous errors
warning: build failed, waiting for other jobs to finish...
error: failed to compile `cargo-sysroot v0.8.0`, intermediate artifacts can be found at `/tmp/cargo-installqc6mEa`

Caused by:
  build failed

And toolchain used to install sysroot is

root@c235c7e9b6fd:/tdshim# rustup toolchain list
nightly-2021-08-20-x86_64-unknown-linux-gnu (default) (override)
1.58.1-x86_64-unknown-linux-gnu

It's a little strange.
git clone and then cargo build succeeds to build cargo-sysroot binary.
But cargo install cargo-sysroot fails.

Tried running with cargo install cargo-sysroot --locked, that fixed it

I'll investigate further at some point later, but for now that'll install it.

Found the issue

At some point anyhow added an identically named Ok function, and this code has a glob import.

The reason it works when built locally is that cargo by default only respects Cargo.lock locally

Cargo-sysroot 0.8.1 has been released to fix this issue