diff options
author | Mahmoud Mohamed <mahadelr19@gmail.com> | 2023-03-13 17:18:11 +0300 |
---|---|---|
committer | Arthur Cohen <arthur.cohen@embecosm.com> | 2024-01-16 18:21:10 +0100 |
commit | 8511a6f5cee5b2b08510a608a89f74098ecfec01 (patch) | |
tree | d175ffbdd772bcc4722fdf926782575c18758ea1 /gcc/rust/backend/rust-compile-expr.cc | |
parent | 1b793f2aa1ad1d64ff2f7508375a407a6d9e7788 (diff) | |
download | gcc-8511a6f5cee5b2b08510a608a89f74098ecfec01.zip gcc-8511a6f5cee5b2b08510a608a89f74098ecfec01.tar.gz gcc-8511a6f5cee5b2b08510a608a89f74098ecfec01.tar.bz2 |
gccrs: resolve: Handle multiple bindings to the same identifier
https://github.com/rust-lang/rust/blob/master/compiler/rustc_resolve/src/late.rs#L3168
This commit follows rustc's implementation of handling multiple bindings
to the same identifier in parameters.
gcc/rust/ChangeLog:
* resolve/rust-ast-resolve-expr.cc (ResolveExpr::visit) :declare and
pass bindings to PatternDeclaration::go.
(ResolveExpr::resolve_closure_param): Likewise.
* resolve/rust-ast-resolve-expr.h: Likewise.
* resolve/rust-ast-resolve-item.cc (ResolveTraitItems::visit): Likewise.
(ResolveItem::visit): Likewise.
* resolve/rust-ast-resolve-pattern.cc (PatternDeclaration::go): Likewise.
(PatternDeclaration::visit): check for previous identifier bindings
before inserting the new one.
* resolve/rust-ast-resolve-pattern.h (enum PatternBoundCtx): New enum.
* resolve/rust-ast-resolve-stmt.h: pass bindings to PatterDeclaration::go.
gcc/testsuite/ChangeLog:
* rust/compile/multiple_bindings1.rs: New test.
Signed-off-by: Mahmoud Mohamed <mahadelr19@gmail.com>
Diffstat (limited to 'gcc/rust/backend/rust-compile-expr.cc')
0 files changed, 0 insertions, 0 deletions