Skip to content

Commit 059b31f

Browse files
committed
Actually call unreachable() in impossible case in type_of_inner
1 parent 57ede5f commit 059b31f

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/comp/middle/trans.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -210,9 +210,11 @@ fn type_of_inner(cx: @crate_ctxt, sp: span, t: ty::t)
210210
ret T_struct([T_i32(), type_of_inner(cx, sp, sub1)]);
211211
}
212212
ty::ty_var(_) {
213-
// FIXME should be a constraint that makes this impossible
214-
// (use unreachable())
215-
cx.tcx.sess.span_fatal(sp, "trans::type_of called on ty_var");
213+
// Should be unreachable b/c of precondition.
214+
// FIXME: would be nice to have a way of expressing this
215+
// through postconditions, and then making it sound to omit
216+
// cases in the alt
217+
std::util::unreachable()
216218
}
217219
ty::ty_param(_, _) { T_typaram(cx.tn) }
218220
ty::ty_type. { T_ptr(cx.tydesc_type) }

0 commit comments

Comments
 (0)