-
Notifications
You must be signed in to change notification settings - Fork 78
Fix clippy warnings for Rust 1.79 #1151
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
Conversation
Only build them when the "mock_test" feature is enabled.
|
Public API Check failed because I removed |
rust-toolchain
Outdated
| @@ -1 +1 @@ | |||
| 1.77.0 | |||
| stable | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You might have accidentally committed this change. The PR shows no intention to change the pinned Rust version.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops. My bad. I reverted this.
| /// | ||
| /// # Safety | ||
| /// The safety of this function is ensured by a down-cast check. | ||
| unsafe fn barrier_impl<B: Barrier<VM>>(&mut self) -> &mut B; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree a binding can implement this method totally on the binding side if they need to. We can remove it.
The comments for write barriers methods mention using a specialized slow-path but they do not specifically mention this method. The comments seem to make sense even if we remove this method from our API. No change is required -- I just mention it in case you would like to improve the comments related to the function.
mmtk-core/src/memory_manager.rs
Line 225 in 47562b7
| /// * Implement fast-path on the VM side, and do a specialized slow-path call. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. The comment mentioned slow path, but it does not mention how to make the "specialized slow-path call". Calling methods of the Barrier trait is only one step of it. I think it is obvious to use downcast to eliminate a dynamic call for a trait that supports it.
qinsoon
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This PR fixes new warnings generated by Clippy after upgrading Rust to 1.79. - Only define `ImmixSpaceArg::mixed_age` when the "vo_bit" feature is enabled. This eliminates a dead code warning. - Use the associated constant `<integer_type>::MAX` (and `MIN`, too) instead of the deprecated `max_value()` method and the `::std::<integer_type>::MAX` constant. - Annotate the destination type of some `transmute` calls. - Use the safe `std::ptr::NonNull::from()` converter instead of `transmute`. - Initialize array elements of type `Atomic<MapState>` from constant. - Remove `MutatorContext::barrier_impl`. It is not used by any bindings right now, and it depends on the layout of `&dyn Trait`. Since `Barrier` has `Downcast` as a supertrait, if a binding needs a reference to a concrete `Barrier` implementation, it should just use downcast. The warning against the `transmute` call in `mock_vm.rs` is suppressed because it is almost impossible to annotate. Also fixes compilation problems: - Made benchmarks related to the "mock_test" feature conditionally compiled so that we don't get compilation error when running `cargo clippy --benches` or `cargo clippy --all-targets`.
This PR fixes new warnings generated by Clippy after upgrading Rust to 1.79.
ImmixSpaceArg::mixed_agewhen the "vo_bit" feature is enabled. This eliminates a dead code warning.<integer_type>::MAX(andMIN, too) instead of the deprecatedmax_value()method and the::std::<integer_type>::MAXconstant.transmutecalls.std::ptr::NonNull::from()converter instead oftransmute.Atomic<MapState>from constant.MutatorContext::barrier_impl. It is not used by any bindings right now, and it depends on the layout of&dyn Trait. SinceBarrierhasDowncastas a supertrait, if a binding needs a reference to a concreteBarrierimplementation, it should just use downcast.The warning against the
transmutecall inmock_vm.rsis suppressed because it is almost impossible to annotate.Also fixes compilation problems:
cargo clippy --benchesorcargo clippy --all-targets.