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

parser: some fixes and QoL improvements for Parsed #848

Merged
merged 5 commits into from
Aug 1, 2023
Merged

parser: some fixes and QoL improvements for Parsed #848

merged 5 commits into from
Aug 1, 2023

Conversation

Kijewski
Copy link
Contributor

@Kijewski Kijewski commented Aug 1, 2023

No description provided.

According to [RFC 1857] the fields of a struct are dropped in the same
order as they are declared. For `struct S { a: A, b: B }` field `a` is
dropped before field `b`.

Our struct `Parsed` is self referencial. Its field `ast` depends on
`source`, so `source` must outlife `ast`. This PR changes the order of
the fields to reflect this requirement. In practice it should not
matter, because we know that the variant of `Node` won't access the
string data during their `Drop`, but better safe than sorry - maybe
`Node` changes in the future.

[RFC 1857]: https://rust-lang.github.io/rfcs/1857-stabilize-drop-order.html
@Kijewski Kijewski changed the title parser: some fixes and QoL improvements for Parser parser: some fixes and QoL improvements for Parsed Aug 1, 2023
askama_parser/src/lib.rs Outdated Show resolved Hide resolved
askama_parser/src/lib.rs Outdated Show resolved Hide resolved
@djc djc merged commit ffe267b into djc:main Aug 1, 2023
18 checks passed
@Kijewski Kijewski deleted the pr-parsed-drop branch August 1, 2023 09:12
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