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

Fix warnings with the stable Rust toolchain #1099

Merged
merged 2 commits into from
Apr 3, 2024

Conversation

wks
Copy link
Collaborator

@wks wks commented Mar 25, 2024

As getting a ref & of static mut variables will become a compilation error in the Rust 2024 Edition, we use unsafe { &*addr_of!(VM_LAYOUT) } to work around it. See: #1098

Changed the static mut in mock_test_doc_avoid_resolving_allocator.rs to an ordinary local variable.

Initialize the thread-local variable WORKER_ORDINAL with a const block. It avoids lazy initialization. We also bumped the rust-version field in Cargo.toml to 1.71.1 because the semantics of the const block in the thread_local! macro was undocumented in 1.70.0.

As getting a ref `&` of `static mut` variables will become a compilation
error in the Rust 2024 Edition, we use `unsafe { &*addr_of!(VM_LAYOUT)
}` to work around it.

See: mmtk#1098

Changed the `static mut` in mock_test_doc_avoid_resolving_allocator.rs
to an ordinary local variable.

Initialize the thread-local variable `WORKER_ORDINAL` with a `const`
block.  It avoids lazy initialization.  We also bumped the
`rust-version` field in Cargo.toml to 1.71.1 because the semantics of
the `const` block in the `thread_local!` macro was undocumented in
1.70.0.
@wks wks requested a review from qinsoon March 25, 2024 13:50
@wks wks changed the title Fix warnings on the stable branch. Fix warnings with the stable Rust toolchain Mar 25, 2024
@@ -10,7 +10,7 @@ repository = "https://github.com/mmtk/mmtk-core"
readme = "README.md"
categories = ["memory-management"]
keywords = ["gc", "garbage", "collection", "garbage-collection", "allocation"]
rust-version = "1.70.0"
rust-version = "1.71.1"
Copy link
Member

Choose a reason for hiding this comment

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

This breaks our MSRV policy. Our pinned Rust version is 1.71.1 and the MSRV should be at max 1.70. We can think about bumping our pinned version (to 1.77).

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I bumped rust-toolchain to 1.77.0.

Copy link
Member

@qinsoon qinsoon left a comment

Choose a reason for hiding this comment

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

LGTM

@qinsoon qinsoon added this pull request to the merge queue Apr 2, 2024
Merged via the queue into mmtk:master with commit d91b203 Apr 3, 2024
23 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