rust/library/core
Matthias Krüger a1b0702ea5
Rollup merge of #103996 - SUPERCILEX:docs, r=RalfJung
Add small clarification around using pointers derived from references

r? `@RalfJung`

One question about your example from https://github.com/rust-lang/libs-team/issues/122: at what point does UB arise? If writing 0 does not cause UB and the reference `x` is never read or written to (explicitly or implicitly by being wrapped in another data structure) after the call to `foo`, does UB only arise when dropping the value? I don't really get that since I thought references were always supposed to point to valid data?

```rust
fn foo(x: &mut NonZeroI32)  {
  let ptr = x as *mut NonZeroI32;
  unsafe { ptr.cast::<i32>().write(0); } // no UB here
  // What now? x is considered garbage when?
}
```
2022-11-13 17:37:36 +01:00
..
benches Rollup merge of #103570 - lukas-code:stabilize-ilog, r=scottmcm 2022-11-09 19:21:21 +05:30
primitive_docs Add primitive documentation to libcore 2021-09-12 02:23:08 +00:00
src Rollup merge of #103996 - SUPERCILEX:docs, r=RalfJung 2022-11-13 17:37:36 +01:00
tests Rollup merge of #104060 - ink-feather-org:const_hash, r=fee1-dead 2022-11-10 10:47:38 -05:00
Cargo.toml Avoid use of rand::thread_rng in stdlib benchmarks 2022-05-02 00:08:21 -07:00