Skip to content

Commit

Permalink
Unrolled build for rust-lang#117385
Browse files Browse the repository at this point in the history
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`
  • Loading branch information
rust-timer authored Oct 30, 2023
2 parents 91bbdd9 + 3f7e506 commit 8f7b6e0
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions compiler/rustc_mir_transform/src/deduce_param_attrs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ impl<'tcx> Visitor<'tcx> for DeduceReadOnly {
// 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(..) => {
Expand Down

0 comments on commit 8f7b6e0

Please sign in to comment.