disallow unsized enums
This commit is contained in:
parent
ac468b67bf
commit
f1695238ca
@ -856,8 +856,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
|
|||||||
trait_name));
|
trait_name));
|
||||||
}
|
}
|
||||||
ObligationCauseCode::FieldSized => {
|
ObligationCauseCode::FieldSized => {
|
||||||
err.note("only the last field of a struct or enum variant \
|
err.note("only the last field of a struct may have a dynamically sized type");
|
||||||
may have a dynamically sized type");
|
|
||||||
}
|
}
|
||||||
ObligationCauseCode::ConstSized => {
|
ObligationCauseCode::ConstSized => {
|
||||||
err.note("constant expressions must have a statically known size");
|
err.note("constant expressions must have a statically known size");
|
||||||
|
@ -150,7 +150,7 @@ impl<'ccx, 'gcx> CheckTypeWellFormedVisitor<'ccx, 'gcx> {
|
|||||||
self.check_variances_for_type_defn(item, ast_generics);
|
self.check_variances_for_type_defn(item, ast_generics);
|
||||||
}
|
}
|
||||||
hir::ItemEnum(ref enum_def, ref 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)
|
fcx.enum_variants(enum_def)
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user