{
  "$type": "site.standard.document",
  "bskyPostRef": {
    "cid": "bafyreiagus3biptw22yj3i4bfh7bariw556qfdlvap3q5ymqajkgyo4pga",
    "uri": "at://did:plc:ivbknywyskln22er3nkssdhl/app.bsky.feed.post/3mp2d3hlmd2j2"
  },
  "path": "/t/a-read-only-no-alias-reference/24410#post_4",
  "publishedAt": "2026-06-24T12:03:04.000Z",
  "site": "https://internals.rust-lang.org",
  "textContent": "It would allow dropping a superfluous `mut` on some variables, for instance:\n\n\n    fn f() {\n        let vector = Mutex::new(vec![1,2,3]);\n        let mut vector_guard = vector.lock().unwrap();\n        vector_guard.push(4);\n    }\n\n\nThe variable `vector_guard` needs to be marked `mut` because `MutexGuard::deref_mut` takes a `&mut self` where it only really needs a `&^ self`. The guard doesn't actually get modified.\n\nBy way of analogy a variable of type `&mut T` doesn't need to be mutable to be dereferenced, it only needs to be unique. The variable `vector_ref` does not need to be marked `mut`:\n\n\n    fn g() {\n        let mut vector = vec![1,2,3];\n        let vector_ref = &mut vector;\n        vector_ref.push(4);\n    }\n",
  "title": "A read only no alias reference"
}