Skip to content

Commit 172dee0

Browse files
JohnAZoidbergetemesi254
authored andcommitted
Fix building with no-std
Trying to build in an no-std doesn't work. Example with zune-jpg and x86_64-unknown-uefi: ``` > cargo build -p zune-jpeg --target x86_64-unknown-uefi --no-default-features Compiling zune-core v0.2.13 (/home/zoid/clone/active/zune-image/zune-core) error[E0463]: can't find crate for `std` | = note: the `x86_64-unknown-uefi` target may not support the standard library = note: `std` is required by `zune_core` because it does not declare `#![no_std]` [...] ``` This seems to be due to a bug (or expected behavior) in the cargo worktrees: rust-lang/cargo#8366 From zune-jpeg we can't disable the default features of zune-core. But that's no problem, since zune-jpeg already enabled the std feature in zune-core, whenver its std feature is enabled. With this patch, compilation succeeds: ``` > cargo build -p zune-jpeg --target x86_64-unknown-uefi --no-default-features Compiling zune-jpeg v0.3.16 (/home/zoid/clone/active/zune-image/zune-jpeg) warning: dropping unsupported crate type `cdylib` for target `x86_64-unknown-uefi` warning: `zune-jpeg` (lib) generated 1 warning Finished dev [unoptimized + debuginfo] target(s) in 0.15s ``` Signed-off-by: Daniel Schaefer <[email protected]>
1 parent 37b3bcf commit 172dee0

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

zune-core/Cargo.toml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,11 @@ license = "MIT OR Apache-2.0 OR Zlib"
1212
[features]
1313
# When present, we can use std facilities to detect
1414
# if a specific feature exists
15+
# Not enabled by default. Other zune crates can enable dep:zune-core/std by default.
16+
# But if we enable it here, they can't disable it anymore.
17+
# See: https://github.com/rust-lang/cargo/issues/8366
1518
std = []
16-
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
17-
default = ["std"]
1819

1920
[dependencies]
2021
bitflags = "2.1.0"
21-
serde = { version = "1.0.52", optional = true }
22+
serde = { version = "1.0.52", optional = true }

0 commit comments

Comments
 (0)