Skip to content

Commit 4673eb6

Browse files
committed
rustc: Fix LLVM type error when generating cmp glue for interior vectors
1 parent 741e771 commit 4673eb6

File tree

1 file changed

+20
-4
lines changed

1 file changed

+20
-4
lines changed

src/comp/middle/trans.rs

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2164,10 +2164,26 @@ fn make_cmp_glue(&@block_ctxt cx, ValueRef lhs0, ValueRef rhs0, &ty::t t,
21642164
// If we hit == all the way through the minimum-shared-length
21652165
// section, default to judging the relative sequence lengths.
21662166

2167-
r =
2168-
compare_numerical_values(scx, vec_fill(scx, lhs),
2169-
vec_fill(scx, rhs), unsigned_int,
2170-
llop);
2167+
auto lhs_fill;
2168+
auto rhs_fill;
2169+
auto bcx;
2170+
if (ty::sequence_is_interior(cx.fcx.lcx.ccx.tcx, t)) {
2171+
auto lad = ivec::get_len_and_data(scx, lhs,
2172+
ty::sequence_element_type(cx.fcx.lcx.ccx.tcx, t));
2173+
bcx = lad._2;
2174+
lhs_fill = lad._0;
2175+
lad = ivec::get_len_and_data(bcx, rhs,
2176+
ty::sequence_element_type(cx.fcx.lcx.ccx.tcx, t));
2177+
bcx = lad._2;
2178+
rhs_fill = lad._0;
2179+
} else {
2180+
lhs_fill = vec_fill(scx, lhs);
2181+
rhs_fill = vec_fill(scx, rhs);
2182+
bcx = scx;
2183+
}
2184+
2185+
r = compare_numerical_values(bcx, lhs_fill, rhs_fill,
2186+
unsigned_int, llop);
21712187
r.bcx.build.Store(r.val, flag);
21722188
} else {
21732189
// == and <= default to true if they find == all the way. <

0 commit comments

Comments
 (0)