From 45a46dc7acd5f521f03dc04e077d5ad9f340096f Mon Sep 17 00:00:00 2001 From: Peter Badida Date: Mon, 14 Sep 2026 14:37:52 +0200 Subject: [PATCH] fix: Revert optional feature syntax The optional feature syntax (`package-name?/feature`) doesn't seem to work properly while vendoring a (sub-)dependency. POC below: FROM rust:alpine WORKDIR /tmp RUN apk add git RUN git clone --depth=1 https://github.com/rust-lang/log vendor/log RUN git clone --depth=1 https://github.com/rust-cli/env_logger vendor/env_logger RUN < vendor/env_logger/fix.patch diff --git a/crates/env_filter/Cargo.toml b/crates/env_filter/Cargo.toml --- a/crates/env_filter/Cargo.toml +++ b/crates/env_filter/Cargo.toml @@ -28,11 +28,11 @@ pre-release-replacements = [ [features] default = ["std", "regex"] regex = ["dep:regex"] -std = ["log/std", "regex?/std"] +std = ["log/std"] [dependencies] log = { version = "0.4.29" } -regex = { version = "1.12.3", optional = true, default-features=false, features=["perf"] } +regex = { version = "1.12.3", optional = true, default-features=false, features=["std", "perf"] } [dev-dependencies] snapbox = "1.0" EOF cd vendor/env_logger&&git apply fix.patch EOR RUN cat vendor/env_logger/crates/env_filter/Cargo.toml RUN < src/main.rs cat< Cargo.toml [package] name = "bug" edition = "2024" [dependencies] env_logger = { version = "0.11.11", default-features = false, features = [] } log = { version = "0.4.34", default-features = false } # note: happens even if not specified here env_filter = { version = "2.0.0", default-features = false, features = [] } [patch.crates-io] env_logger = { path = "vendor/env_logger" } env_filter = { path = "vendor/env_logger/crates/env_filter" } log = { path = "vendor/log" } EOF EOR RUN <