Skip to content

[unsafe] Wrap initialization of global variables in unsafe#106

Merged
nunoplopes merged 5 commits into
Cpp2Rust:masterfrom
lucic71:global-initialziers
May 17, 2026
Merged

[unsafe] Wrap initialization of global variables in unsafe#106
nunoplopes merged 5 commits into
Cpp2Rust:masterfrom
lucic71:global-initialziers

Conversation

@lucic71
Copy link
Copy Markdown
Contributor

@lucic71 lucic71 commented May 16, 2026

The initializer of a global variable might use another global variable. We translate global variables as static mut. All usages of static mut are unsafe, hence the initializer of a global variable must also be wrapped in unsafe.

@lucic71 lucic71 force-pushed the global-initialziers branch from df82b4d to 90bcc74 Compare May 17, 2026 18:21
@lucic71 lucic71 force-pushed the global-initialziers branch from 90bcc74 to b17178f Compare May 17, 2026 18:39
@nunoplopes nunoplopes merged commit 8fc93ee into Cpp2Rust:master May 17, 2026
9 checks passed
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