From 059b31f7a3a58193db1dc80a3bd32cbb36f00e1d Mon Sep 17 00:00:00 2001 From: Tim Chevalier Date: Thu, 15 Sep 2011 23:14:24 -0700 Subject: [PATCH] Actually call unreachable() in impossible case in type_of_inner --- src/comp/middle/trans.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/comp/middle/trans.rs b/src/comp/middle/trans.rs index 4a1e7c4cd425..42d57031d648 100644 --- a/src/comp/middle/trans.rs +++ b/src/comp/middle/trans.rs @@ -210,9 +210,11 @@ fn type_of_inner(cx: @crate_ctxt, sp: span, t: ty::t) ret T_struct([T_i32(), type_of_inner(cx, sp, sub1)]); } ty::ty_var(_) { - // FIXME should be a constraint that makes this impossible - // (use unreachable()) - cx.tcx.sess.span_fatal(sp, "trans::type_of called on ty_var"); + // Should be unreachable b/c of precondition. + // FIXME: would be nice to have a way of expressing this + // through postconditions, and then making it sound to omit + // cases in the alt + std::util::unreachable() } ty::ty_param(_, _) { T_typaram(cx.tn) } ty::ty_type. { T_ptr(cx.tydesc_type) }