rustc: Check struct field types when heap memory lint checks are enabled
This commit is contained in:
parent
91676f3fa6
commit
15871a7458
1 changed files with 12 additions and 0 deletions
|
@ -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(
|
let visit = item_stopping_visitor(
|
||||||
visit::mk_simple_visitor(@visit::SimpleVisitor {
|
visit::mk_simple_visitor(@visit::SimpleVisitor {
|
||||||
visit_expr: |e: @ast::expr| {
|
visit_expr: |e: @ast::expr| {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue