In uninit checking, add fallback for polymorphic types#10553
In uninit checking, add fallback for polymorphic types#10553bors merged 1 commit intorust-lang:masterfrom
Conversation
|
r? @xFrednet (rustbot has picked a reviewer for you, use r? to override) |
|
Would be good to add a test for #10565 as well |
9d574b2 to
13baac9
Compare
13baac9 to
51b4d2a
Compare
|
Thanks for the follow up, looks good to me @bors r+ |
|
☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test |
|
I believe this still does not fully fix the issue, monoio still get false positive. https://github.com/bytedance/monoio/actions/runs/4635132256/jobs/8205680770?pr=157 struct Page<T> {
// continued buffer of fixed size
slots: Box<[MaybeUninit<Entry<T>>]>,
}
impl<T> Page<T> {
fn new(size: usize, prev_len: usize) -> Self {
let mut buffer = Vec::with_capacity(size);
unsafe { buffer.set_len(size) };
let slots = buffer.into_boxed_slice();
Self {
slots,
}
}
}I am using clippy 0.1.70 (23ee2af 2023-04-07). |
|
The fix is not yet available on nightly, it will be in the one after rust-lang/rust#110003 is merged I'll add a beta-nominated label to ensure it's in the same release as #10520, not sure how that works out timing wise |
|
This will get into the same beta/stable version as #10520. No action required AFAICT. |
After #10520, we always assumed that polymorphic types do not allow to be left uninitialized. But we can do better, by peeking into polymorphic types and adding a few special cases for going through tuples, arrays (because the length may be polymorphic) and blanket allowing all unions (like MaybeUninit).
fixes #10551
changelog: [uninit_vec]: fix false positive for polymorphic types
changelog: [uninit_assumed_init]: fix false positive for polymorphic types