Skip to content

Commit 749fb47

Browse files
committed
---
yaml --- r: 5055 b: refs/heads/master c: 0abec86 h: refs/heads/master i: 5053: 2b5e2ad 5051: 5aa0a6a 5047: fe89400 5039: 59b12c2 5023: 62eb3f1 4991: 6bd25f7 v: v3
1 parent ebfeaa0 commit 749fb47

File tree

4 files changed

+26
-8
lines changed

4 files changed

+26
-8
lines changed

[refs]

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 4c936d7992123e029dedea0380f429b6844a9ab8
2+
refs/heads/master: 0abec867c346a73e72410cbe9360eb16c2fbdd22

trunk/src/comp/middle/trans.rs

+15-5
Original file line numberDiff line numberDiff line change
@@ -4409,12 +4409,22 @@ fn trans_fail_expr(cx: &@block_ctxt, sp_opt: &option::t<span>,
44094409
let e_ty = ty::expr_ty(tcx, expr);
44104410
bcx = expr_res.bcx;
44114411

4412-
44134412
if ty::type_is_str(tcx, e_ty) {
4414-
let elt =
4415-
GEP(bcx, expr_res.val,
4416-
[C_int(0), C_int(abi::vec_elt_data)]);
4417-
ret trans_fail_value(bcx, sp_opt, elt);
4413+
let is_istr = alt ty::struct(tcx, e_ty) {
4414+
ty::ty_istr. { true }
4415+
_ { false }
4416+
};
4417+
if !is_istr {
4418+
let elt =
4419+
GEP(bcx, expr_res.val,
4420+
[C_int(0), C_int(abi::vec_elt_data)]);
4421+
ret trans_fail_value(bcx, sp_opt, elt);
4422+
} else {
4423+
let data = ivec::get_dataptr(
4424+
bcx, expr_res.val,
4425+
type_of_or_i8(bcx, ty::mk_mach(tcx, ast::ty_u8)));
4426+
ret trans_fail_value(bcx, sp_opt, data);
4427+
}
44184428
} else {
44194429
bcx_ccx(cx).sess.span_bug(expr.span,
44204430
~"fail called with unsupported type "

trunk/src/comp/middle/typeck.rs

+9-1
Original file line numberDiff line numberDiff line change
@@ -1860,7 +1860,15 @@ fn check_expr_with_unifier(fcx: &@fn_ctxt, expr: &@ast::expr, unify: &unifier,
18601860
bot = true;
18611861
alt expr_opt {
18621862
none. {/* do nothing */ }
1863-
some(e) { check_expr_with(fcx, e, ty::mk_str(tcx)); }
1863+
some(e) {
1864+
// FIXME: istr transitional. Should be:
1865+
// check_expr_with(fcx, e, ty::mk_str(tcx));
1866+
check_expr(fcx, e);
1867+
if !are_compatible(fcx, expr_ty(tcx, e), ty::mk_str(tcx))
1868+
&& !are_compatible(fcx, expr_ty(tcx, e), ty::mk_istr(tcx)) {
1869+
check_expr_with(fcx, e, ty::mk_str(tcx));
1870+
}
1871+
}
18641872
}
18651873
write::bot_ty(tcx, id);
18661874
}
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
// error-pattern:wooooo
22
// no-valgrind
3-
fn main() { let a = 1; if 1 == 1 { a = 2; } fail "woooo" + "o"; }
3+
fn main() { let a = 1; if 1 == 1 { a = 2; } fail ~"woooo" + ~"o"; }

0 commit comments

Comments
 (0)