Skip to content

Commit b4457fb

Browse files
committed
Rollup merge of rust-lang#23859 - pnkfelix:fsk-lesser-box, r=nikomatsakis
Disallow writing through mutable pointers stored in non-mut Box. Fix rust-lang#14270 The fix works by making `cmt::freely_aliasable` result more fine-grained. Instead of encoding the aliasability (i.e. whether the cmt is uniquely writable or not) as an option, now pass back an enum indicating either: 1. freely-aliasable (thus not uniquely-writable), 2. non-aliasable (thus uniquely writable), or 3. unique but immutable (and thus not uniquely writable, according to proposal from issue rust-lang#14270.) This is all of course a giant hack that will hopefully go away with an eventually removal of special treatment of `Box<T>` (aka `ty_unique`) from the compiler.
2 parents 2c0329c + e434053 commit b4457fb

File tree

6 files changed

+223
-65
lines changed

6 files changed

+223
-65
lines changed

src/librustc/middle/expr_use_visitor.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -885,6 +885,11 @@ impl<'d,'t,'tcx,TYPER:mc::Typer<'tcx>> ExprUseVisitor<'d,'t,'tcx,TYPER> {
885885
}
886886
}
887887

888+
// When this returns true, it means that the expression *is* a
889+
// method-call (i.e. via the operator-overload). This true result
890+
// also implies that walk_overloaded_operator already took care of
891+
// recursively processing the input arguments, and thus the caller
892+
// should not do so.
888893
fn walk_overloaded_operator(&mut self,
889894
expr: &ast::Expr,
890895
receiver: &ast::Expr,

0 commit comments

Comments
 (0)