diff options
| author | Ralf Jung <post@ralfj.de> | 2023-10-30 10:29:08 +0100 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2023-10-30 10:29:08 +0100 |
| commit | 3f7e50696f04e713311b841c4446dbf800ffaf6a (patch) | |
| tree | 83186840305079df90a5ab290eb73b4dc4a03934 | |
| parent | 91bbdd927a5e53a2fe126304fe8adbedf339616c (diff) | |
deduce_param_attrs: explain a read-only case
| -rw-r--r-- | compiler/rustc_mir_transform/src/deduce_param_attrs.rs | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/compiler/rustc_mir_transform/src/deduce_param_attrs.rs b/compiler/rustc_mir_transform/src/deduce_param_attrs.rs index 79645310a39..990cfb05e60 100644 --- a/compiler/rustc_mir_transform/src/deduce_param_attrs.rs +++ b/compiler/rustc_mir_transform/src/deduce_param_attrs.rs @@ -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(..) => { |
