From f1695238cae0c7c6598fa736820837d35a2143cf Mon Sep 17 00:00:00 2001 From: Tim Neumann Date: Wed, 12 Oct 2016 12:40:48 +0200 Subject: [PATCH] disallow unsized enums --- src/librustc/traits/error_reporting.rs | 3 +-- src/librustc_typeck/check/wfcheck.rs | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/librustc/traits/error_reporting.rs b/src/librustc/traits/error_reporting.rs index 52ddd8ab5dac..4aff84d81996 100644 --- a/src/librustc/traits/error_reporting.rs +++ b/src/librustc/traits/error_reporting.rs @@ -856,8 +856,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { trait_name)); } ObligationCauseCode::FieldSized => { - err.note("only the last field of a struct or enum variant \ - may have a dynamically sized type"); + err.note("only the last field of a struct may have a dynamically sized type"); } ObligationCauseCode::ConstSized => { err.note("constant expressions must have a statically known size"); diff --git a/src/librustc_typeck/check/wfcheck.rs b/src/librustc_typeck/check/wfcheck.rs index bc5cb68995b2..e3634cfe5f5e 100644 --- a/src/librustc_typeck/check/wfcheck.rs +++ b/src/librustc_typeck/check/wfcheck.rs @@ -150,7 +150,7 @@ impl<'ccx, 'gcx> CheckTypeWellFormedVisitor<'ccx, 'gcx> { self.check_variances_for_type_defn(item, ast_generics); } hir::ItemEnum(ref enum_def, ref ast_generics) => { - self.check_type_defn(item, false, |fcx| { + self.check_type_defn(item, true, |fcx| { fcx.enum_variants(enum_def) });