Stream: t-lang/wg-unsafe-code-guidelines

Topic: assume_init vs safety invariant


RalfJ (Aug 05 2019 at 18:16, on Zulip):

The MaybeUninit docs warn about validity vs safety (without using that terminology), but assume_init only links to that. Do you think it is worth repeating that warning? https://github.com/rust-lang/rust/pull/63298

centril (Aug 05 2019 at 20:52, on Zulip):

Yes, redundancy is a good thing :slight_smile:

RalfJ (Aug 05 2019 at 21:19, on Zulip):

@centril see mark's comment there. are we okay saying what we are saying about Vec?

centril (Aug 05 2019 at 21:20, on Zulip):

Let me double check

centril (Aug 05 2019 at 21:22, on Zulip):

https://doc.rust-lang.org/nightly/std/vec/struct.Vec.html#guarantees

centril (Aug 05 2019 at 21:23, on Zulip):

@RalfJ tho what does 1-initialized Vec<T> mean in terms of code?

centril (Aug 05 2019 at 21:23, on Zulip):

I reviewed too hastily it seems :D

RalfJ (Aug 06 2019 at 07:44, on Zulip):

RalfJ tho what does 1-initialized Vec<T> mean in terms of code?

maybe_uninit_vec.as_mut_ptr().write_bytes(1u8, 1)

RalfJ (Aug 06 2019 at 07:45, on Zulip):

or maybe 0xFFu8 is better

RalfJ (Aug 06 2019 at 07:48, on Zulip):

I pushed the other edit we talked about

RalfJ (Aug 06 2019 at 07:53, on Zulip):

@centril ^

Last update: Nov 19 2019 at 18:30UTC