Skip to content

Conversation

@mischnic
Copy link
Member

@mischnic mischnic commented Sep 24, 2025

Part of #1056

Lifetime problem that I figured out already
error[E0309]: the parameter type `R` may not live long enough
   --> src/rules/mod.rs:436:56
    |
436 | #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize), serde(transparent))]
    |                                                        ^^^^^^^^^^^^^^^^^^ ...so that the type `R` will meet its required lifetime bounds
...
439 | pub struct CssRuleList<'i, R = DefaultAtRule>(
    |                        -- the parameter type `R` must be valid for the lifetime `'i` as defined here...
    |
    = note: this error originates in the derive macro `serde::Deserialize` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider adding an explicit lifetime bound
    |
439 | pub struct CssRuleList<'i, R: 'i = DefaultAtRule>(
    |                             ++++

For more information about this error, try `rustc --explain E0309`.
error: could not compile `lightningcss` (lib) due to 1 previous error

Copy link
Member

@devongovett devongovett left a comment

Choose a reason for hiding this comment

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

I think we may need to use a crate that provides similar functionality to the private types so that we can buffer correctly. e.g. serde_value

}
Field::Value => {
value = Some(map.next_value()?);
let rule_type = rule_type.as_ref().ok_or_else(|| serde::de::Error::missing_field("type"))?;
Copy link
Member

Choose a reason for hiding this comment

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

Is it safe to assume that the type field always comes before the value field? I think that's why it was buffering before.

@devongovett
Copy link
Member

See #1062

@mischnic mischnic deleted the mischnic/serde branch September 30, 2025 11:49
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.

3 participants