dylanhart / ulid-rs

This is a Rust implementation of the ulid project

Home Page:https://crates.io/crates/ulid

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Fails to compile with `uuid` feature

schmidmt opened this issue · comments

When compiling with

cargo 1.57.0 (b2e52d7ca 2021-10-21)
rustc 1.57.0 (f1edd0429 2021-11-29)

the following errors occur:

➜ cargo build --features uuid
  Compiling uuid v0.8.2
error[E0412]: cannot find type `Uuid` in this scope
  --> /Users/schmidmt/.cargo/registry/src/github.com-1ecc6299db9ec823/uuid-0.8.2/src/adapter/mod.rs:917:19
   |
917 |           impl From<Uuid> for $T {
   |                     ^^^^ not found in this scope
...
934 | / impl_adapter_traits! {
935 | |     Hyphenated<>,
936 | |     HyphenatedRef<'a>,
937 | |     Simple<>,
...   |
940 | |     UrnRef<'a>
941 | | }
   | |_- in this macro invocation
   |
   = note: this error originates in the macro `impl_adapter_from` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0412]: cannot find type `Uuid` in this scope
  --> /Users/schmidmt/.cargo/registry/src/github.com-1ecc6299db9ec823/uuid-0.8.2/src/adapter/mod.rs:919:24
   |
919 |               fn from(f: Uuid) -> Self {
   |                          ^^^^ not found in this scope
...
934 | / impl_adapter_traits! {
935 | |     Hyphenated<>,
936 | |     HyphenatedRef<'a>,
937 | |     Simple<>,
...   |
940 | |     UrnRef<'a>
941 | | }
   | |_- in this macro invocation
   |
   = note: this error originates in the macro `impl_adapter_from` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0412]: cannot find type `Uuid` in this scope
  --> /Users/schmidmt/.cargo/registry/src/github.com-1ecc6299db9ec823/uuid-0.8.2/src/adapter/mod.rs:925:27
   |
925 |           impl<$a> From<&$a Uuid> for $T<$a> {
   |                             ^^^^ not found in this scope
...

I'm unable to reproduce this failure on x86_64 Windows and Linux. This is also a build failure originating from the uuid package. Can you validate that uuid-0.8.2 builds for you in isolation?

git clone https://github.com/uuid-rs/uuid.git -b 0.8.2
cd uuid
cargo build

The uuid package seems to compile correctly by itself. As it does in a project; when replacing the uuid crate with ulid I encountered the error mentioned above.

uuid on  HEAD (b68733d) is 📦 v0.8.2 via 🦀 v1.57.0
➜ cargo build
   Compiling uuid v0.8.2 (/Users/schmidmt/code/uuid)
    Finished dev [unoptimized + debuginfo] target(s) in 1.35s

This is quite strange...

For completeness, I am on a Mac. I just tried it in the rust:1.57 docker image, and it worked just fine. It seems to be an issue with the Mac toolchain, I suppose. Anyway, the problem seems to be elsewhere. Thanks for looking into it.

For anyone who encountered this, I solved this by removing all caching files in .cargo, though don't delete your config files :).