KokaKiwi / rust-hex

A basic crate to encode values to hexadecimal representation. Originally extracted from rustc-serialize.
https://crates.io/crates/hex
Apache License 2.0
203 stars 57 forks source link

implicit dependency of "std" for "serde" feature in published 0.4.2 #40

Closed kentfredric closed 3 years ago

kentfredric commented 4 years ago

I've just been testing a few things as part of my linux vendoring efforts, and I stumbled upon this:

cargo +system build --no-default-features --features 'serde' ``` Updating crates.io index Compiling proc-macro2 v1.0.8 Compiling unicode-xid v0.2.0 Compiling syn v1.0.14 Compiling serde v1.0.104 Compiling quote v1.0.2 Compiling serde_derive v1.0.104 Compiling hex v0.4.2 (/home/kent/.cpanm/work/1582182020.22342/hex-0.4.2) error[E0433]: failed to resolve: use of undeclared type or module `std` --> src/serde.rs:19:5 | 19 | use std::marker::PhantomData; | ^^^ use of undeclared type or module `std` error[E0432]: unresolved import `std` --> src/serde.rs:18:5 | 18 | use std::fmt; | ^^^ help: a similar path exists: `serde::std` error[E0412]: cannot find type `String` in this scope --> src/serde.rs:31:37 | 31 | let s = data.encode_hex_upper::(); | ^^^^^^ not found in this scope | help: possible candidates are found in other modules, you can import them into scope | 15 | use alloc::prelude::v1::String; | 15 | use alloc::string::String; | error[E0412]: cannot find type `String` in this scope --> src/serde.rs:45:31 | 45 | let s = data.encode_hex::(); | ^^^^^^ not found in this scope | help: possible candidates are found in other modules, you can import them into scope | 15 | use alloc::prelude::v1::String; | 15 | use alloc::string::String; | error[E0412]: cannot find type `PhantomData` in this scope --> src/serde.rs:59:29 | 59 | struct HexStrVisitor(PhantomData); | ^^^^^^^^^^^ not found in this scope | help: possible candidates are found in other modules, you can import them into scope | 15 | use core::marker::PhantomData; | 15 | use serde::export::PhantomData; | error[E0425]: cannot find value `PhantomData` in this scope --> src/serde.rs:87:48 | 87 | deserializer.deserialize_str(HexStrVisitor(PhantomData)) | ^^^^^^^^^^^ not found in this scope | help: possible candidates are found in other modules, you can import them into scope | 15 | use core::marker::PhantomData; | 15 | use serde::export::PhantomData; | error: aborting due to 6 previous errors Some errors have detailed explanations: E0412, E0425, E0432, E0433. For more information about an error, try `rustc --explain E0412`. error: could not compile `hex`. warning: build failed, waiting for other jobs to finish... error: build failed ```

It may not be important shrug. Though I suspect this can be fixed.