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

derive: make sure that static CACHE is never dropped #108

Merged
merged 3 commits into from
Aug 2, 2024

Conversation

Kijewski
Copy link
Collaborator

@Kijewski Kijewski commented Aug 1, 2024

We assume that static CACHE of Configs is never dropped, so we only pass &'static Config around. It is an implementation detail in rust, that static variables (currently) aren't dropped at the program's termination. This PR makes sure that this behavior stays the same even if this fact is changed later on.

Also, needless usages of Arc and some some unsafe code was removed.

We assume that `static CACHE` of `Config`s is never dropped, so we only
pass `&'static Config` around. It is an implementation detail in rust,
that `static` variables (currently) aren't dropped at the program's
termination.

This PR makes sure that this behavior stays the same even if this fact
is changed later on.
@GuillaumeGomez
Copy link
Contributor

Good idea, thanks!

@Kijewski Kijewski merged commit e0b716a into rinja-rs:master Aug 2, 2024
17 checks passed
@Kijewski Kijewski deleted the pr-dont-drop-static branch August 2, 2024 11:58
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