Skip to content
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

Fix inference conflict with serde_json through schemars feature #733

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

ratmice
Copy link
Contributor

@ratmice ratmice commented Nov 4, 2024

Initially marking as a draft, because this currently just fiddles with Cargo.toml to ensure that CI tests the feature.
this shouldn't actually require any changes to our CI scripts to trigger, and as Daniel suggested, this uses a feature on with_winit rather than vello itself.

Will follow up with the actual fix once I've confirmed CI fails.

@ratmice ratmice marked this pull request as ready for review November 4, 2024 15:16
Copy link
Member

@DJMcNab DJMcNab left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other than the additional dependency edge, LGTM.

@@ -45,6 +45,7 @@ vello_shaders = { version = "0.3.0", path = "vello_shaders" }
bytemuck = { version = "1.18.0", features = ["derive"] }
skrifa = "0.22.3"
peniko = "0.2.0"
kurbo = "0.11.1"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is used

Copy link
Contributor Author

@ratmice ratmice Nov 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is required by the addtion of kurbo = { workspace = true, optional = true } in with_winit/Cargo.toml
without that it gets the following:

error: process didn't exit successfully: `~/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/cargo metadata --format-version=1 --no-deps` (exit status: 101)
--- stderr
error: failed to load manifest for workspace member `~/git/linebender/vello/examples/with_winit`
referenced by workspace at `~/git/linebender/vello/Cargo.toml`

Caused by:
  failed to parse manifest at `~/git/linebender/vello/examples/with_winit/Cargo.toml`

Caused by:
  error inheriting `kurbo` from workspace root manifest's `workspace.dependencies.kurbo`
error: process didn't exit successfully: `~/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/cargo metadata --format-version=1 --no-deps` (exit status: 101)
--- stderr
error: failed to load manifest for workspace member `~/git/linebender/vello/examples/with_winit`
referenced by workspace at `~/git/linebender/vello/Cargo.toml`

Caused by:
  failed to parse manifest at `~/git/linebender/vello/examples/with_winit/Cargo.toml`

Caused by:
  error inheriting `kurbo` from workspace root manifest's `workspace.dependencies.kurbo`

Caused by:
  `dependency.kurbo` was not found in `workspace.dependencies`

We could I suppose specify 0.11.1 in with_winit rather than picking it up from the workspace,
but the two versions (the one inherited through peniko, and the one specified explicitly) need to be kept in sync
to trigger the error (at least that is my belief, until a time where we have the feature supported in peniko itself).

So a bit oddly neither i with_winit or in the root Cargo.toml is perhaps an ideal place for it.

Copy link
Member

@DJMcNab DJMcNab Nov 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, this is just my mistake. I misunderstood the context of this change

Copy link
Contributor Author

@ratmice ratmice Nov 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps at the very least we could add a comment specifying that the kurbo line can be removed once peniko supports the schemars feature and needs to be kept in sync with the version of kurbo used by peniko?

Edit: Added in 049892c

Copy link
Member

@DJMcNab DJMcNab Nov 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might also work to use a "*" version, but I don't have a good intuition about whether that will do what you want; it might be worth having a #[test] when the hidden feature is enabled which validates that the Peniko and Kurbo versions are compatible.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding a #[test] definitely sounds like a good idea, will do.
I don't have a good intuition about whether a "*" version will do the right thing either though.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added that #[test] in ac97f1e, I don't think it will automagically run during ci.
but at the very least you can do so manually with cargo test --features _ci_dep_features_to_test
That said I did try to take care that the test doesn't actually require initializing gpu, etc.

@DJMcNab DJMcNab changed the title Enabling the kurbo schemars feature causes type inference issue due to a trait conflict with serde_json Fix inference conflict with serde_json through schemars feature Nov 4, 2024
@DJMcNab
Copy link
Member

DJMcNab commented Nov 7, 2024

Is anything blocking this now? @ratmice you should have permission to merge this if it's finished.

@ratmice
Copy link
Contributor Author

ratmice commented Nov 7, 2024

No there was nothing really blocking, I just am always hesitant to pull the trigger when things have been approved, but i've made subsequent changes since then, given that I've made more changes, I'll give it a few days at least unless anything further comes up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants