]> git.lizzy.rs Git - rust.git/commit
Modify the ExprUseVisitor to walk each part of an AutoRef, and in
authorNiko Matsakis <niko@alum.mit.edu>
Wed, 8 Apr 2015 08:31:51 +0000 (04:31 -0400)
committerNiko Matsakis <niko@alum.mit.edu>
Wed, 8 Apr 2015 13:49:41 +0000 (09:49 -0400)
commit1e79870770c08973d018e71d309816b970c7abe1
treec79a72d0d40b70c2ed13c9be1610785949589717
parentce97c197c2ba3f89818721728cff219258497a69
Modify the ExprUseVisitor to walk each part of an AutoRef, and in
particular to treat an AutoUnsize as as kind of "instantaneous" borrow
of the value being unsized. This prevents us from feeding uninitialized
data.

This caused a problem for the eager reborrow of comparison traits,
because that wound up introducing a "double AutoRef", which was not
being thoroughly checked before but turned out not to type check.
Fortunately, we can just remove that "eager reborrow" as it is no longer
needed now that `PartialEq` doesn't force both LHS and RHS to have the
same type (and even if we did have this problem, the better way would be
to lean on introducing a common supertype).
src/librustc/middle/check_const.rs
src/librustc/middle/expr_use_visitor.rs
src/librustc/middle/mem_categorization.rs
src/librustc_borrowck/borrowck/check_loans.rs
src/librustc_borrowck/borrowck/mod.rs
src/librustc_typeck/check/op.rs
src/librustc_typeck/check/regionck.rs
src/test/compile-fail/borrowck-use-uninitialized-in-cast-trait.rs [new file with mode: 0644]
src/test/compile-fail/borrowck-use-uninitialized-in-cast.rs [new file with mode: 0644]