]> git.lizzy.rs Git - rust.git/commitdiff
rollup merge of #18337 : bkoropoff/unboxed-imm-upvar-fixes
authorAlex Crichton <alex@alexcrichton.com>
Mon, 27 Oct 2014 16:07:56 +0000 (09:07 -0700)
committerAlex Crichton <alex@alexcrichton.com>
Mon, 27 Oct 2014 22:12:45 +0000 (15:12 -0700)
1  2 
src/librustc/middle/borrowck/check_loans.rs
src/librustc/middle/borrowck/mod.rs
src/librustc/middle/mem_categorization.rs

index f5e849f41967da8d5b28a4b37834a44901a9d8fd,bdcf01b21abd99b6978460cbe5e2031b7cef9b7a..de61f4f2b404c78a46b7defe3b9d719c2e572e9c
@@@ -831,6 -845,16 +845,15 @@@ impl<'a, 'tcx> CheckLoanCtxt<'a, 'tcx> 
                          return;
                      }
  
 -                    mc::cat_discr(b, _) |
+                     mc::cat_deref(_, _, mc::BorrowedPtr(..)) => {
+                         assert_eq!(cmt.mutbl, mc::McDeclared);
+                         // We need to drill down to upvar if applicable
+                         match cmt.upvar() {
+                             Some(b) => cmt = b,
+                             None => return
+                         }
+                     }
                      mc::cat_deref(b, _, mc::OwnedPtr) => {
                          assert_eq!(cmt.mutbl, mc::McInherited);
                          cmt = b;
Simple merge