Last active
August 29, 2015 13:56
-
-
Save chromatic/9262349 to your computer and use it in GitHub Desktop.
Failing patch for Rust #12378
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/librustc/middle/trans/controlflow.rs b/src/librustc/middle/tran | |
index ad575eb..8875283 100644 | |
--- a/src/librustc/middle/trans/controlflow.rs | |
+++ b/src/librustc/middle/trans/controlflow.rs | |
@@ -14,6 +14,7 @@ use middle::trans::base::*; | |
use middle::trans::build::*; | |
use middle::trans::callee; | |
use middle::trans::common::*; | |
+use middle::trans::datum::{Datum, Lvalue, Rvalue, ByValue}; | |
use middle::trans::debuginfo; | |
use middle::trans::cleanup; | |
use middle::trans::cleanup::CleanupMethods; | |
@@ -400,7 +401,15 @@ pub fn trans_fail_bounds_check<'a>( | |
len: ValueRef) | |
-> &'a Block<'a> { | |
let _icx = push_ctxt("trans_fail_bounds_check"); | |
- let (filename, line) = filename_and_line_num_from_span(bcx, sp); | |
+ let loc = bcx.sess().parse_sess.cm.lookup_char_pos(sp.lo); | |
+ | |
+ let line = Datum(C_int(bcx.ccx(), loc.line as int), | |
+ ty::mk_uint(), Rvalue(ByValue)).to_appropriate_datum(bcx); | |
+ let filename = Datum(C_str_slice(bcx.ccx(), | |
+ token::intern_and_get_ident(loc.file.name)), | |
+ ty::mk_str(bcx.tcx(), ty::vstore_slice(ty::ReStatic)), | |
+ Rvalue(ByValue)).to_appropriate_datum(bcx); | |
+ | |
let args = ~[filename, line, index, len]; | |
let did = langcall(bcx, Some(sp), "", FailBoundsCheckFnLangItem); | |
let bcx = callee::trans_lang_call(bcx, did, args, Some(expr::Ignore)).bcx; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment