diff options
-rw-r--r-- | gcc/rust/lint/rust-lint-marklive.h | 6 | ||||
-rw-r--r-- | gcc/testsuite/rust/compile/torture/borrow_function.rs | 5 |
2 files changed, 11 insertions, 0 deletions
diff --git a/gcc/rust/lint/rust-lint-marklive.h b/gcc/rust/lint/rust-lint-marklive.h index f6d4b09..14364d2 100644 --- a/gcc/rust/lint/rust-lint-marklive.h +++ b/gcc/rust/lint/rust-lint-marklive.h @@ -39,6 +39,11 @@ public: void visit (HIR::PathInExpression &expr) override; void visit (HIR::IdentifierExpr &expr) override; + void visit (HIR::BorrowExpr &expr) override + { + expr.get_expr ().get ()->accept_vis (*this); + } + void visit (HIR::BlockExpr &expr) override { expr.iterate_stmts ([&] (HIR::Stmt *s) mutable -> bool { @@ -50,6 +55,7 @@ public: expr.get_final_expr ().get ()->accept_vis (*this); } } + void visit (HIR::Function &function) override { function.get_definition ().get ()->accept_vis (*this); diff --git a/gcc/testsuite/rust/compile/torture/borrow_function.rs b/gcc/testsuite/rust/compile/torture/borrow_function.rs new file mode 100644 index 0000000..98c6f99 --- /dev/null +++ b/gcc/testsuite/rust/compile/torture/borrow_function.rs @@ -0,0 +1,5 @@ +fn foo() {} + +fn main() { + let _a = &foo; +}
\ No newline at end of file |