Make sure to enforce ~const DerefMut on mutability fixup

This commit is contained in:
Michael Goulet 2024-11-03 04:40:35 +00:00
parent e03e9abe3c
commit 7bd595d216

View File

@ -296,6 +296,7 @@ pub(crate) fn convert_place_derefs_to_mutable(&self, expr: &hir::Expr<'_>) {
);
};
*deref = OverloadedDeref { mutbl, span: deref.span };
self.enforce_context_effects(expr.span, method.def_id, method.args);
// If this is a union field, also throw an error for `DerefMut` of `ManuallyDrop` (see RFC 2514).
// This helps avoid accidental drops.
if inside_union