rustc: Check struct field types when heap memory lint checks are enabled
This commit is contained in:
parent
91676f3fa6
commit
15871a7458
|
@ -786,6 +786,18 @@ fn check_item_heap(cx: ty::ctxt, it: @ast::item) {
|
|||
_ => ()
|
||||
}
|
||||
|
||||
// If it's a struct, we also have to check the fields' types
|
||||
match it.node {
|
||||
ast::item_struct(struct_def, _) => {
|
||||
for struct_def.fields.each |struct_field| {
|
||||
check_type(cx, struct_field.node.id, it.id,
|
||||
struct_field.span,
|
||||
ty::node_id_to_type(cx, struct_field.node.id));
|
||||
}
|
||||
}
|
||||
_ => ()
|
||||
}
|
||||
|
||||
let visit = item_stopping_visitor(
|
||||
visit::mk_simple_visitor(@visit::SimpleVisitor {
|
||||
visit_expr: |e: @ast::expr| {
|
||||
|
|
Loading…
Reference in New Issue