deduce_param_attrs: explain a read-only case
This commit is contained in:
parent
91bbdd927a
commit
3f7e50696f
@ -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
|
// Whether mutating though a `&raw const` is allowed is still undecided, so we
|
||||||
// disable any sketchy `readonly` optimizations for now.
|
// disable any sketchy `readonly` optimizations for now.
|
||||||
// But we only need to do this if the pointer would point into the argument.
|
// 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()
|
!place.is_indirect()
|
||||||
}
|
}
|
||||||
PlaceContext::NonMutatingUse(..) | PlaceContext::NonUse(..) => {
|
PlaceContext::NonMutatingUse(..) | PlaceContext::NonUse(..) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user