diff options
author | Thomas Young <wenzhang5800@gmail.com> | 2021-06-25 13:10:45 +0800 |
---|---|---|
committer | Thomas Young <wenzhang5800@gmail.com> | 2021-06-25 13:11:18 +0800 |
commit | 862722c6889008068f7dacb553ae130843276a02 (patch) | |
tree | 4b851bb8bee77eeea809c9867b049a928efa0c07 /gcc | |
parent | 1a05bb190e5b6a6f45a1a4d448c24a60f82535b1 (diff) | |
download | gcc-862722c6889008068f7dacb553ae130843276a02.zip gcc-862722c6889008068f7dacb553ae130843276a02.tar.gz gcc-862722c6889008068f7dacb553ae130843276a02.tar.bz2 |
mark live symbol in deref exp
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/rust/lint/rust-lint-marklive.h | 5 | ||||
-rw-r--r-- | gcc/testsuite/rust/compile/torture/deref_function.rs | 10 |
2 files changed, 15 insertions, 0 deletions
diff --git a/gcc/rust/lint/rust-lint-marklive.h b/gcc/rust/lint/rust-lint-marklive.h index 14364d2..8651dd2 100644 --- a/gcc/rust/lint/rust-lint-marklive.h +++ b/gcc/rust/lint/rust-lint-marklive.h @@ -44,6 +44,11 @@ public: expr.get_expr ().get ()->accept_vis (*this); } + void visit (HIR::DereferenceExpr &expr) override + { + expr.get_expr ().get ()->accept_vis (*this); + } + void visit (HIR::BlockExpr &expr) override { expr.iterate_stmts ([&] (HIR::Stmt *s) mutable -> bool { diff --git a/gcc/testsuite/rust/compile/torture/deref_function.rs b/gcc/testsuite/rust/compile/torture/deref_function.rs new file mode 100644 index 0000000..b1c5ff6 --- /dev/null +++ b/gcc/testsuite/rust/compile/torture/deref_function.rs @@ -0,0 +1,10 @@ +fn foo() {} + + +fn main() { + let _c = *{ + let _a = foo; + let b = &1; + b + }; +}
\ No newline at end of file |