build: Exclude wgpu-core when building the WebGPU-backend samples#9557
Open
andyleiserson wants to merge 2 commits into
Open
build: Exclude wgpu-core when building the WebGPU-backend samples#9557andyleiserson wants to merge 2 commits into
andyleiserson wants to merge 2 commits into
Conversation
kpreid
suggested changes
May 20, 2026
| pub unsafe fn as_hal<A: hal::Api>( | ||
| &self, | ||
| ) -> Option<impl Deref<Target = A::Buffer> + WasmNotSendSync> { | ||
| ) -> Option<impl core::ops::Deref<Target = A::Buffer> + WasmNotSendSync> { |
Collaborator
There was a problem hiding this comment.
This change doesn't seem to have anything to do with this PR? I like it, but it's not in the PR description.
Contributor
Author
There was a problem hiding this comment.
When wgpu_core is removed from the build, the module-scope core::ops::Deref import becomes unused in WebGPU-only builds. I made this change to resolve that warning. (Although I did not check whether the warning is enforced in CI, maybe this configuration is an exception?).
Collaborator
There was a problem hiding this comment.
I see. In that case, I would consider doing one of these three instead:
#[allow(unused_imports)]
use core::ops::Deref;#[cfg_attr(not(wgpu_core)), expect(unused_imports))]
use core::ops::Deref;use core::ops;
// ... use all ops items as ops::Foo I would consider all of these superior to making the import style inconsistent in an undocumented way. But that’s my opinion, not wgpu project style.
9bf349f to
10de8e1
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In trying to reproduce the error discussed in #9537 (comment), I found that I was getting a different failure:
This was because
wgpu-corewas being pulled into the sample build for the WebGPU backend becausenoopappears in the workspace feature list. To fix this, removenoopfrom the workspace feature list. Also fix some build warnings exposed by that change.There are two other subtle interactions that appear in the diff:
wgpu-examplesincludes thetracefeature. To build withoutwgpu-core, I've added a direct dependency fromwgputowgpu-types/trace(normally it is pulled in indirectly viawgpu->wgpu-core?/trace->wgpu-types/trace). It would also be possible to fix this by adding atracefeature towgpu-examplesor by removing tracing from the examples entirely.--edges no-devto thewgpu-dependencytest becausewgpu-exampleshas a dev-dependency onwgpu-coreviawgpu-test. However, this test could previously pass without--edges no-dev, not sure if we might want to maintain that property where it holds for some reason.Testing
Adds
wgpu-examplesto thewgpu-dependencytest.Squash or Rebase? Squash
Checklist
wgpumay be affected behaviorally.CHANGELOG.mdentries for the user-facing effects of this change are present.