Skip to content

Commit 288ab16

Browse files
authored
Rollup merge of rust-lang#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`
2 parents 4f4b38c + 3f7e506 commit 288ab16

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

Diff for: compiler/rustc_mir_transform/src/deduce_param_attrs.rs

+1
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ impl<'tcx> Visitor<'tcx> for DeduceReadOnly {
4444
// Whether mutating though a `&raw const` is allowed is still undecided, so we
4545
// disable any sketchy `readonly` optimizations for now.
4646
// But we only need to do this if the pointer would point into the argument.
47+
// IOW: for indirect places, like `&raw (*local).field`, this surely cannot mutate `local`.
4748
!place.is_indirect()
4849
}
4950
PlaceContext::NonMutatingUse(..) | PlaceContext::NonUse(..) => {

0 commit comments

Comments
 (0)