From 2c21195b216a93b8a97de1cab45da76ddb24b90b Mon Sep 17 00:00:00 2001 From: Patrick Walton Date: Thu, 24 Mar 2011 10:24:37 -0700 Subject: [PATCH] rustc: Emit a better error message when a type is used where a value was expected --- src/comp/middle/typeck.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/comp/middle/typeck.rs b/src/comp/middle/typeck.rs index a52b39e2ac8..47ef81c1952 100644 --- a/src/comp/middle/typeck.rs +++ b/src/comp/middle/typeck.rs @@ -184,6 +184,11 @@ fn ty_params_and_ty_for_def(@fn_ctxt fcx, &ast.def defn) ret tup(none[vec[ast.def_id]], plain_ty(ty.ty_nil)); } + case (ast.def_ty(_)) { + fcx.ccx.sess.err("expected value but found type"); + fail; + } + case (_) { // FIXME: handle other names. fcx.ccx.sess.unimpl("definition variant");