rust/library/core
Ben Kimock f4a7ed4338 Fix &mut invalidation in ptr::swap doctest
Under Stacked Borrows with raw pointer tagging, the previous code was UB
because the code which creates the the second pointer borrows the array
through a tag in the borrow stacks below the Unique tag that our first
pointer is based on, thus invalidating the first pointer.

This is not definitely a bug and may never be real UB, but I desperately
want people to write code that conforms to SB with raw pointer tagging
so that I can write good diagnostics. The alternative aliasing models
aren't possible to diagnose well due to state space explosion.
Therefore, it would be super cool if the standard library nudged people
towards writing code that is valid with respect to SB with raw pointer
tagging.
2022-04-03 16:16:33 -04:00
..
benches Use implicit capture syntax in format_args 2022-03-10 10:23:40 -05:00
primitive_docs Add primitive documentation to libcore 2021-09-12 02:23:08 +00:00
src Fix &mut invalidation in ptr::swap doctest 2022-04-03 16:16:33 -04:00
tests Rollup merge of #95556 - declanvk:nonnull-provenance, r=dtolnay 2022-04-02 03:34:24 +02:00
Cargo.toml Build libcore as 2021 in a few more places 2022-02-06 15:41:01 -08:00