-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Add stderr
and termcolor
features to Naga
#7482
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Sorry for taking so long on this one! I'd put it off because I strongly suspected there was an easier way to do this without duplicating logic. Finally found time to investigate a bit, and it looks like I'm right. I added 1f0c355 to put the tip of this PR in the state I think it should be. Whaddaya think? If that looks good to you, then I'm happy to rope in another maintainer for a quick rubber stamp. 🙂 |
0299bf3
to
b513e20
Compare
b513e20
to
f858519
Compare
Instead of mixing `dyn` and `impl`
No need to apologize! Thanks for taking your time on this!
I like it! My only concern is something I regret in the upstream change I made to
Just making a slight change to use |
@gfx-rs/wgpu: Would appreciate a second set of eyes for the overall diff to make sure somebody else is happy with the work we're doing here. Otherwise, I intend to merge in the next couple of days. 😀 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small notes
Co-Authored-By: Connor Fitzgerald <[email protected]>
Co-Authored-By: Connor Fitzgerald <[email protected]>
I believe the test failure is spurious. |
## Enables colored output through codespan-reporting and termcolor. | ||
termcolor = ["codespan-reporting/termcolor"] | ||
|
||
## Enables writing output to stderr. | ||
stderr = ["codespan-reporting/std"] | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
issue(non-blocking): I'm concerned that the code being changed here, though historically changed only infrequently, might become brittle in an unpleasant way for future maintenance; the amount of cfg
we're doing here suggests we'll need to be careful around it.
suggestion(if-minor): Could we add some CI for testing this particular 2x2 matrix of termcolor
and stderr
being enabled? I suppose this could be follow-up work, given the amount of the work we've already done here.
Sorry for the belated feedback here; I know we're late in this process.
CC @cwfitzgerald.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree feature coverage is a tricky problem to manage. Looking at the current CI:
wgpu
requirestermcolor
, sotermcolor && !stderr
is coveredno_std
wont be compatible with either feature, so in the near-term there will be ano_std
test that will cover!termcolor && !stderr
- CI already checks for all features, so that covers
termcolor && stderr
That leaves !termcolor && stderr
as the untested configuration that would need to be explicitly added to CI.
I would suggest a follow-up PR which adds a CI task specifically to test stagnation-risk feature configurations. I imagine it would use a matrix of package and features, and run those against Clippy.
# check-stagnation.yml
jobs:
check-stagnation:
strategy:
fail-fast: false
matrix:
include:
- name: Windows x86_64
package: naga
features: "stderr"
steps:
# ...
- name: Clippy
shell: bash
run: |
set -e
cargo clippy -p ${{ matrix.package}} --features ${{ matrix.features }} --no-default-features
This would allow for a single place for all "stagnation-risk" combinations to live in CI, making it clear these are supported combinations, but might be worth refactoring in the future since they aren't actively used internally.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think having a platform independent CI check is a good idea as it could be pretty quick. Yeah I think that would be fine, but I worry that this is a patch over the bigger problem of how many features we have and testing that more generically
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets definitely not block this on it though
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[...] I worry that this is a patch over the bigger problem of how many features we have and testing that more generically
Yeah we're tackling that very issue in Bevy right now too. You might be interested in looking at bevyengine/bevy#18822. I'm hoping to remove a lot of feature complexity from Bevy using it, and it gives us cfg_aliases
without a build.rs
, which is a nice bonus.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting! I worry about how well RA will tolerate working inside a macro
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
Co-authored-by: Connor Fitzgerald <[email protected]> Co-authored-by: Erich Gubler <[email protected]>
Connections
Description
To add eventual
no_std
support,termcolor
must be an optional dependency. It is currently only required bycodespan-reporting
when itstermcolor
feature is enabled. This PR adds a similartermcolor
feature tonaga
, which is enabled innaga-cli
,wgpu
, andwgpu-hal
. Additionally, astderr
feature was added to allow enabling thestd
crate withinnaga
for the purposes of usingstd::io::stderr
directly whentermcolor
cannot be used. This is currently only enabled innaga-cli
since the public API gated by this feature is unused in the rest of WGPU.Testing
Compiled with and without
termcolor
feature enabled.Squash or Rebase?
Squash
Checklist
cargo fmt
.taplo format
.cargo clippy --tests
. If applicable, add:--target wasm32-unknown-unknown
cargo xtask test
to run tests.CHANGELOG.md
entry.