dylanhart / ulid-rs

This is a Rust implementation of the ulid project
https://crates.io/crates/ulid
MIT License
385 stars 37 forks source link

Fails to compile with `uuid` feature #43

Closed schmidmt closed 2 years ago

schmidmt commented 2 years ago

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
...
dylanhart commented 2 years ago

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?

dylanhart commented 2 years ago
git clone https://github.com/uuid-rs/uuid.git -b 0.8.2
cd uuid
cargo build
schmidmt commented 2 years ago

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...

schmidmt commented 2 years ago

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.

schmidmt commented 2 years ago

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