提交 16ec9aa6 编写于 作者: N Niko Matsakis

Support assignability for struct fields. r=pcwalton

上级 4557f704
......@@ -1679,9 +1679,11 @@ fn check_struct_or_variant_fields(fcx: @fn_ctxt,
let expected_field_type =
ty::lookup_field_type(
tcx, class_id, field_id, substitutions);
bot |= check_expr(fcx,
field.node.expr,
Some(expected_field_type));
bot |=
check_expr_with_assignability(
fcx,
field.node.expr,
expected_field_type);
class_field_map.insert(
field.node.ident, (field_id, true));
fields_found += 1;
......
struct Foo {
x: &int
}
fn main() {
let f = Foo { x: @3 };
assert *f.x == 3;
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册