servo / stylo

39 stars 11 forks source link

[BUG] Improper dependencies in Stylo #12

Closed sepcnt closed 4 months ago

sepcnt commented 4 months ago

Description:

While working with Stylo, I encountered a trait bound error. The error message indicates that the trait serde::Serialize is not implemented for Url, which is required by servo_arc::Arc<Url>: serde::Serialize.

Error Details:

The error occurs in the file ~\.cargo\git\checkouts\stylo-d5871ad1ba1940d3\e2a4834\style\servo\url.rs at line 211. Here is the relevant code and error message:

211 | #[derive(Clone, Debug, Deserialize, MallocSizeOf, PartialEq, Serialize)]
    |                                                              ^^^^^^^^^ the trait `serde::Serialize` is not implemented for `Url`, which is required by `servo_arc::Arc<Url>: serde::Serialize`
...
216 |     Valid(#[ignore_malloc_size_of = "Arc"] Arc<Url>),
    |           ----------------------------------------- required by a bound introduced by this call

Expected Behavior:

The Url type should be serializable as it is used within an Arc in the Valid variant of an enum (or similar data structure).

Actual Behavior:

The compiler throws a trait bound error because Url does not implement serde::Serialize.

nicoburns commented 4 months ago

I think the "servo" feature (or the "serde" feature) of stylo needs to enable the "serde" feature of the "url" crate. This probably doesn't affect servo because it is already enabling that feature itself.

sepcnt commented 4 months ago

Also webrender_api may not in malloc_size_of/servo feature set but malloc_size_of/webrender_api

#[cfg(feature = "webrender_api")]
extern crate webrender_api;
mrobinson commented 4 months ago

This issue is fixed by #9.