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

Move static ctor out of unsafe context #294

Merged
merged 1 commit into from
Aug 7, 2023

Conversation

domenukk
Copy link
Contributor

@domenukk domenukk commented Aug 7, 2023

On master, the following test succeeds to mutate and read the mutable static test boolean without the use of an unsafe keyword:

extern crate ctor;
use ctor::*;

static mut test: bool = false;
#[ctor]
static STATIC_CTOR: bool = {
  test = true;
  test
}

This PR fixes the issue

Copy link
Owner

@mmastrac mmastrac left a comment

Choose a reason for hiding this comment

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

LGTM

@mmastrac mmastrac merged commit 1b5e7cd into mmastrac:master Aug 7, 2023
4 checks passed
@mmastrac
Copy link
Owner

mmastrac commented Aug 7, 2023

@domenukk Thanks for the two excellent PRs. Both are merged and I'll release a new version shortly. If you are interested in contributing more, I'd be happy to add you as a full contributor on the project.

@domenukk
Copy link
Contributor Author

domenukk commented Aug 8, 2023

Thanks for merging! I'll gladly send more PRs if I come across other things :)

@domenukk
Copy link
Contributor Author

Is there a release on crates with these fixes yet?

@mmastrac
Copy link
Owner

I just pushed 0.2.5 with a cargo update bump and all the latest changes, so that's definitely up-to-date!

@domenukk
Copy link
Contributor Author

Thank you! :)

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