Revert "Forbid classes with no fields" due to test failures
This reverts commit 8fd9986f0f
.
This commit is contained in:
parent
c6e16c5668
commit
e56a6e8cb0
@ -387,12 +387,6 @@ fn check_item(ccx: @crate_ctxt, it: @ast::item) {
|
|||||||
};
|
};
|
||||||
// typecheck the members
|
// typecheck the members
|
||||||
for members.each {|m| check_class_member(class_ccx, class_t, m); }
|
for members.each {|m| check_class_member(class_ccx, class_t, m); }
|
||||||
// Check that there's at least one field
|
|
||||||
let (fields,_) = split_class_items(members);
|
|
||||||
if fields.len() < 1u {
|
|
||||||
ccx.tcx.sess.span_err(it.span, "A class must have at least one \
|
|
||||||
field");
|
|
||||||
}
|
|
||||||
// Check that the class is instantiable
|
// Check that the class is instantiable
|
||||||
check_instantiable(ccx.tcx, it.span, it.id);
|
check_instantiable(ccx.tcx, it.span, it.id);
|
||||||
}
|
}
|
||||||
|
@ -1,9 +0,0 @@
|
|||||||
class c { //! ERROR A class must have at least one field
|
|
||||||
new() { }
|
|
||||||
}
|
|
||||||
|
|
||||||
fn main() {
|
|
||||||
let a = c();
|
|
||||||
let x = [a];
|
|
||||||
let _y = x[0];
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user