-
Notifications
You must be signed in to change notification settings - Fork 6
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
Misc cleanups before allowing usage with stable Rust #23
Open
bonzini
wants to merge
11
commits into
Rust-for-Linux:main
Choose a base branch
from
bonzini:cleanup-pre-stable
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bonzini
force-pushed
the
cleanup-pre-stable
branch
from
November 4, 2024 14:33
a8ed63c
to
8dafd4c
Compare
new_uninit is stable as of 1.82.0, there is no need to require it. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Some of the error messages have changed in nightly Rust, since the .stderr files were last checked. Update everything. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reuse examples/error.rs so that the error returned by EvenU64::new2() is not core::alloc::AllocError. This will allow running the test without the allocator_api feature. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
The big_struct_in_place example only uses init!, which has no dependency on the allocator API (which provides the functionality of fallible initialization). Do not enable allocator_api. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Run nightly cargo fmt so that the corresponding GitHub check passes. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
bonzini
force-pushed
the
cleanup-pre-stable
branch
from
November 4, 2024 14:47
8dafd4c
to
b74dc46
Compare
Successful CI run at bonzini#1 |
Prefer inspect_err over map_err, when the resulting error is the same as the argument. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Arc support in pinned_init requires a specific unstable feature, get_mut_unchecked. Separate the tests for Arc to a different function, so that in the future it is easier to only require get_mut_unchecked when a specific feature is added. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
The only dependency of the InPlaceInit trait on the allocator API is the AllocError type. Replace it with Infallible instead, i.e. allow any error as long as it has an "impl From<Infallible> for MyError" - which can have a trivial implementation as seen in examples/rror.rs. While admittedly of limited usefulness due to orphan rules, this is a first step towards allowing usage of pinned_init entirely without the allocator API, and therefore on stable Rust. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
bonzini
force-pushed
the
cleanup-pre-stable
branch
from
November 4, 2024 15:39
b74dc46
to
3cc7086
Compare
thanks for the PR! I am currently very busy, so I might take some time before getting this in |
Thanks, could you at least approval the workflow so that I can fix any issues? |
there is one issue with a ui test that the main branch is also failing at the moment, so I expect it to also fail here. I'll fix that (hopefully) soon |
I think it's one of those that I fixed. :) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
It is actually not that hard to make
pinned_init
usable with stable Rust. In particular:new_uninit
has been stabilized (and anyway in the end it was just a glorifiedBox::<MaybeUninit<T>>::new()
)allocator_api
is needed to have fallible allocation, but not if you just replacecore::alloc::AllocError
withcore::convert::Infallible
get_mut_unchecked
is needed if you needArc
, but otherwise is not necessary.This pull request fixes CI and isolates a little bit more the pieces of code that refer to
Arc
orfeature(allocator_api)
. The idea is that these are mostly uncontroversial changes that should not hamper readability and maintainability, and therefore can be committed separately.Please let me know if I should submit separately the small changes to
src/lib.rs
, for example via the rust-for-linux mailing list.