]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc_trans/trans/controlflow.rs
Auto merge of #31052 - bluss:split-at-mut-str, r=alexcrichton
[rust.git] / src / librustc_trans / trans / controlflow.rs
index 875eb353cf7e349bf341289e045e6d7e662eb965..fc3bd4f4d02330de8d693f339bb33b713d05849c 100644 (file)
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 use llvm::ValueRef;
-use middle::def;
+use middle::def::Def;
 use middle::lang_items::{PanicFnLangItem, PanicBoundsCheckFnLangItem};
 use trans::base::*;
 use trans::basic_block::BasicBlock;
@@ -22,6 +22,7 @@
 use trans::debuginfo;
 use trans::debuginfo::{DebugLoc, ToDebugLoc};
 use trans::expr;
+use trans::machine;
 use trans;
 use middle::ty;
 
@@ -109,7 +110,7 @@ pub fn trans_block<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
     fcx.push_ast_cleanup_scope(cleanup_debug_loc);
 
     for s in &b.stmts {
-        bcx = trans_stmt(bcx, &**s);
+        bcx = trans_stmt(bcx, s);
     }
 
     if dest != expr::Ignore {
@@ -321,7 +322,7 @@ pub fn trans_break_cont<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
         None => fcx.top_loop_scope(),
         Some(_) => {
             match bcx.tcx().def_map.borrow().get(&expr.id).map(|d| d.full_def())  {
-                Some(def::DefLabel(loop_id)) => loop_id,
+                Some(Def::Label(loop_id)) => loop_id,
                 r => {
                     bcx.tcx().sess.bug(&format!("{:?} in def-map for label", r))
                 }
@@ -401,7 +402,8 @@ pub fn trans_fail<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
     let filename = C_str_slice(ccx, filename);
     let line = C_u32(ccx, loc.line as u32);
     let expr_file_line_const = C_struct(ccx, &[v_str, filename, line], false);
-    let expr_file_line = consts::addr_of(ccx, expr_file_line_const, "panic_loc");
+    let align = machine::llalign_of_min(ccx, val_ty(expr_file_line_const));
+    let expr_file_line = consts::addr_of(ccx, expr_file_line_const, align, "panic_loc");
     let args = vec!(expr_file_line);
     let did = langcall(bcx, Some(call_info.span), "", PanicFnLangItem);
     let bcx = callee::trans_lang_call(bcx,
@@ -433,7 +435,8 @@ pub fn trans_fail_bounds_check<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
     let filename = C_str_slice(ccx,  filename);
     let line = C_u32(ccx, loc.line as u32);
     let file_line_const = C_struct(ccx, &[filename, line], false);
-    let file_line = consts::addr_of(ccx, file_line_const, "panic_bounds_check_loc");
+    let align = machine::llalign_of_min(ccx, val_ty(file_line_const));
+    let file_line = consts::addr_of(ccx, file_line_const, align, "panic_bounds_check_loc");
     let args = vec!(file_line, index, len);
     let did = langcall(bcx, Some(call_info.span), "", PanicBoundsCheckFnLangItem);
     let bcx = callee::trans_lang_call(bcx,