Skip to content

Commit

Permalink
Rollup merge of rust-lang#23859 - pnkfelix:fsk-lesser-box, r=nikomats…
Browse files Browse the repository at this point in the history
…akis

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.
  • Loading branch information
Manishearth committed Mar 31, 2015
2 parents 2c0329c + e434053 commit b4457fb
Show file tree
Hide file tree
Showing 6 changed files with 223 additions and 65 deletions.
5 changes: 5 additions & 0 deletions src/librustc/middle/expr_use_visitor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -885,6 +885,11 @@ impl<'d,'t,'tcx,TYPER:mc::Typer<'tcx>> ExprUseVisitor<'d,'t,'tcx,TYPER> {
}
}

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

0 comments on commit b4457fb

Please sign in to comment.