{
  "$type": "site.standard.document",
  "bskyPostRef": {
    "cid": "bafyreih6wvif3kw6nq6hjc4li5di25bzg3fpworfelleqdq5qxzpb6q2ru",
    "uri": "at://did:plc:ivbknywyskln22er3nkssdhl/app.bsky.feed.post/3mlq7p3q2sfe2"
  },
  "path": "/t/include-racy-reads-in-rust-memory-model-with-maybeinvalid-t/24289#post_14",
  "publishedAt": "2026-05-13T11:35:30.000Z",
  "site": "https://internals.rust-lang.org",
  "tags": [
    "get_mut",
    "atomic bytewise memcpy"
  ],
  "textContent": "josh:\n\n> I am not suggesting at any point that we have a \"location for which reads are racy by default\". I do think it makes sense to have \"location that permits explicitly performing racy read operations\", so that writers know that's a possibility to account for, even if not every reader does it.\n\nI don't really know what you mean by this. But location-based models typically just behave poorly, _especially_ in Rust where we have operations like get_mut which allow \"normal\" non-atomic accesses to what otherwise look like \"atomic locations\".\n\njosh:\n\n> then I'd need to know more about what that implies before agreeing that's a sensible model. For instance, does \"dereference the pointer\" count as \"program behavior ever depends on what the value is\"?\n\nI don't know which pointer you mean. But deref'ing an `undef` pointer is UB, yes. At this point I think we are entirely talking past each other though.\n\nIf you want to load a pointer in a way that allows races, we already have a way to do that: `AtomicPtr::load` (with `Ordering::Relaxed` if you want to get just a regular boring load instruction). This thread is about situations where the existing atomic APIs we have do not suffice, such as SeqLocks (which can be implemented neither in C nor Rust nor C++ at the moment; the intended way to fix that is atomic bytewise memcpy ).\n\nRCU exists in many variants and at least some of them are entirely compatible with the C++ memory model and hence can already be implemented in Rust.",
  "title": "Include racy reads in Rust memory model with `MaybeInvalid<T>`"
}