disallow unsized enums

This commit is contained in:
Tim Neumann 2016-10-12 12:40:48 +02:00
parent ac468b67bf
commit f1695238ca
2 changed files with 2 additions and 3 deletions

View File

@ -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");

View File

@ -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)
});