Frommi / miniz_oxide

Rust replacement for miniz
MIT License
168 stars 48 forks source link

Compilation of libstd broken when using miniz_oxide 0.4.2 #97

Closed bjorn3 closed 3 years ago

bjorn3 commented 3 years ago

Likely caused by #95.

$ cargo update -p miniz_oxide
    Updating crates.io index
    Updating miniz_oxide v0.4.0 -> v0.4.2
$ ./x.py check
[...]
error[E0463]: can't find crate for `std`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0463`.
error: could not compile `miniz_oxide`.
oyvindln commented 3 years ago

Hm, I guess the auto-detection isn't quite working as intended then, in-std compilation is not supposed to be using std.

Lokathor commented 3 years ago

Usually, a crate would just have an explicit std feature (probably off by default) which you turn on if you want to use the standard library. And then if you're building on 1.34 or 1.35 you'd use std (since there's no alloc crate) and then if you're 1.36 or later you'd be able to skip the std feature and the alloc crate would be used. But, that's all a breaking change of course.

I guess, do we file a bug with autocfg and hope they track it down?

oyvindln commented 3 years ago

There is already a rustc-dep-of-std feature for building inside libstd. It seems autocfg doesn't work properly in this case. Maybe you can just manually define has_alloc if that feature is enabled though, since it implies alloc.

oyvindln commented 3 years ago

@bjorn3 are you able to test if 5a5522d fixes it? I don't have everything set up for building libstd right now.

bjorn3 commented 3 years ago

Thanks, that fixes it.