Support assignability for struct fields. r=pcwalton
This commit is contained in:
parent
4557f70487
commit
16ec9aa6e7
@ -1679,9 +1679,11 @@ fn check_expr_with_unifier(fcx: @fn_ctxt,
|
||||
let expected_field_type =
|
||||
ty::lookup_field_type(
|
||||
tcx, class_id, field_id, substitutions);
|
||||
bot |= check_expr(fcx,
|
||||
bot |=
|
||||
check_expr_with_assignability(
|
||||
fcx,
|
||||
field.node.expr,
|
||||
Some(expected_field_type));
|
||||
expected_field_type);
|
||||
class_field_map.insert(
|
||||
field.node.ident, (field_id, true));
|
||||
fields_found += 1;
|
||||
|
9
src/test/run-pass/struct-field-assignability.rs
Normal file
9
src/test/run-pass/struct-field-assignability.rs
Normal file
@ -0,0 +1,9 @@
|
||||
struct Foo {
|
||||
x: &int
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let f = Foo { x: @3 };
|
||||
assert *f.x == 3;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user