Skip to content

Commit fa48562

Browse files
authored
Avoid introducing spurious features for optional dependencies (#5691)
* Avoid introducing spurious features for optional dependencies If a feature depends on an optional dependency without using the dep: prefix, a feature with the same name as the optional dependency is introduced. This feature almost certainly won't have any effect when enabled other than increasing compile times and polutes the feature list shown by cargo add. Consistently use dep: for all optional dependencies to avoid this problem. * Add changelog entry
1 parent ebbf901 commit fa48562

File tree

5 files changed

+34
-28
lines changed

5 files changed

+34
-28
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,12 @@ By @stefnotch in [#5410](https://github.com/gfx-rs/wgpu/pull/5410)
7070

7171
#### Naga
7272

73+
### Changes
74+
75+
#### General
76+
77+
- Avoid introducing spurious features for optional dependencies. By @bjorn3 in [#5691](https://github.com/gfx-rs/wgpu/pull/5691)
78+
7379
### Bug Fixes
7480

7581
#### GLES / OpenGL

naga/Cargo.toml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,15 @@ all-features = true
2222
[features]
2323
default = []
2424
dot-out = []
25-
glsl-in = ["pp-rs"]
25+
glsl-in = ["dep:pp-rs"]
2626
glsl-out = []
2727
msl-out = []
28-
serialize = ["serde", "bitflags/serde", "indexmap/serde"]
29-
deserialize = ["serde", "bitflags/serde", "indexmap/serde"]
28+
serialize = ["dep:serde", "bitflags/serde", "indexmap/serde"]
29+
deserialize = ["dep:serde", "bitflags/serde", "indexmap/serde"]
3030
arbitrary = ["dep:arbitrary", "bitflags/arbitrary", "indexmap/arbitrary"]
31-
spv-in = ["petgraph", "spirv"]
32-
spv-out = ["spirv"]
33-
wgsl-in = ["hexf-parse", "unicode-xid", "compact"]
31+
spv-in = ["dep:petgraph", "dep:spirv"]
32+
spv-out = ["dep:spirv"]
33+
wgsl-in = ["dep:hexf-parse", "dep:unicode-xid", "compact"]
3434
wgsl-out = []
3535
hlsl-out = []
3636
compact = []

wgpu-core/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ strict_asserts = ["wgt/strict_asserts"]
5151
serde = ["dep:serde", "wgt/serde", "arrayvec/serde"]
5252

5353
## Enable API tracing.
54-
trace = ["ron", "serde", "naga/serialize"]
54+
trace = ["dep:ron", "serde", "naga/serialize"]
5555

5656
## Enable API replaying
5757
replay = ["serde", "naga/deserialize"]

wgpu-hal/Cargo.toml

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -34,30 +34,30 @@ targets = [
3434

3535
[features]
3636
default = ["link"]
37-
metal = ["naga/msl-out", "block"]
37+
metal = ["naga/msl-out", "dep:block"]
3838
vulkan = [
3939
"naga/spv-out",
40-
"ash",
41-
"gpu-alloc",
42-
"gpu-descriptor",
43-
"libloading",
44-
"smallvec",
45-
"android_system_properties",
40+
"dep:ash",
41+
"dep:gpu-alloc",
42+
"dep:gpu-descriptor",
43+
"dep:libloading",
44+
"dep:smallvec",
45+
"dep:android_system_properties",
4646
]
4747
gles = [
4848
"naga/glsl-out",
49-
"glow",
50-
"glutin_wgl_sys",
51-
"khronos-egl",
52-
"libloading",
53-
"ndk-sys",
49+
"dep:glow",
50+
"dep:glutin_wgl_sys",
51+
"dep:khronos-egl",
52+
"dep:libloading",
53+
"dep:ndk-sys",
5454
]
5555
dx12 = [
5656
"naga/hlsl-out",
57-
"d3d12",
58-
"bit-set",
59-
"libloading",
60-
"range-alloc",
57+
"dep:d3d12",
58+
"dep:bit-set",
59+
"dep:libloading",
60+
"dep:range-alloc",
6161
"winapi/std",
6262
"winapi/winbase",
6363
"winapi/d3d12",
@@ -66,9 +66,9 @@ dx12 = [
6666
"winapi/dxgi1_6",
6767
]
6868
# TODO: This is a separate feature until Mozilla okays windows-rs, see https://github.com/gfx-rs/wgpu/issues/3207 for the tracking issue.
69-
windows_rs = ["gpu-allocator"]
70-
dxc_shader_compiler = ["hassle-rs"]
71-
renderdoc = ["libloading", "renderdoc-sys"]
69+
windows_rs = ["dep:gpu-allocator"]
70+
dxc_shader_compiler = ["dep:hassle-rs"]
71+
renderdoc = ["dep:libloading", "dep:renderdoc-sys"]
7272
fragile-send-sync-non-atomic-wasm = ["wgt/fragile-send-sync-non-atomic-wasm"]
7373
link = ["metal/link"]
7474
# Panic when running into an out-of-memory error (for debugging purposes).

wgpu/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ vulkan-portability = ["wgc?/vulkan"]
5050
## Enables the GLES backend on Wasm
5151
##
5252
## * ⚠️ WIP: Currently will also enable GLES dependencies on any other targets.
53-
webgl = ["hal", "wgc/gles"]
53+
webgl = ["dep:hal", "wgc/gles"]
5454

5555
#! **Note:** In the documentation, if you see that an item depends on a backend,
5656
#! it means that the item is only available when that backend is enabled _and_ the backend
@@ -69,7 +69,7 @@ glsl = ["naga/glsl-in", "wgc/glsl"]
6969
wgsl = ["wgc?/wgsl"]
7070

7171
## Enable accepting naga IR shaders as input.
72-
naga-ir = ["naga"]
72+
naga-ir = ["dep:naga"]
7373

7474
#! ### Logging & Tracing
7575
# --------------------------------------------------------------------

0 commit comments

Comments
 (0)