mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-28 20:16:58 +03:00
Rollup merge of #117385 - RalfJung:deduce_param_attrs, r=oli-obk
deduce_param_attrs: explain a read-only case This takes the discussion [here](https://github.com/rust-lang/rust/pull/111517/files#r1243443625) and adds it as comment in the code. Cc `@lukas-code`
This commit is contained in:
@@ -44,6 +44,7 @@ fn visit_place(&mut self, place: &Place<'tcx>, context: PlaceContext, _location:
|
||||
// Whether mutating though a `&raw const` is allowed is still undecided, so we
|
||||
// disable any sketchy `readonly` optimizations for now.
|
||||
// But we only need to do this if the pointer would point into the argument.
|
||||
// IOW: for indirect places, like `&raw (*local).field`, this surely cannot mutate `local`.
|
||||
!place.is_indirect()
|
||||
}
|
||||
PlaceContext::NonMutatingUse(..) | PlaceContext::NonUse(..) => {
|
||||
|
||||
Reference in New Issue
Block a user