diff options
author | Philip Herron <herron.philip@googlemail.com> | 2023-03-17 22:46:37 +0000 |
---|---|---|
committer | Philip Herron <philip.herron@embecosm.com> | 2023-03-20 21:47:57 +0000 |
commit | a8662e89f84e91466acc09e28b4a289d298498ee (patch) | |
tree | 33cfd871de61c050019fdb3434a3bb6faed8ec36 /gcc/rust/backend | |
parent | 70b83a23f508d3694aa08cda793bab118a9be768 (diff) | |
download | gcc-a8662e89f84e91466acc09e28b4a289d298498ee.zip gcc-a8662e89f84e91466acc09e28b4a289d298498ee.tar.gz gcc-a8662e89f84e91466acc09e28b4a289d298498ee.tar.bz2 |
gccrs: support use declaration to write the type into the correct namespace
This builds upon the previous path resolution fixes so that it returns the
resolved_node_id or UNKNOWN_NODEID on failure to resolve the use-path.
It then exports the name to the current module namespace so it can be used.
Fixes #850 #855
gcc/rust/ChangeLog:
* ast/rust-ast.h: add const get_final_segment helper
* hir/rust-ast-lower-enumitem.h: dont add an item mapping for enumitems
* hir/rust-ast-lower-item.cc (ASTLoweringItem::visit): add enum to enum-items mappings
* hir/rust-ast-lower-stmt.cc (ASTLoweringStmt::visit): likewise
* hir/tree/rust-hir-item.h: add non const helper to get variants
* resolve/rust-ast-resolve-item.cc (ResolveItem::visit): resolve the use declaration
* resolve/rust-ast-resolve-path.cc (ResolvePath::resolve_path): handle self
* resolve/rust-ast-resolve-toplevel.h: add enum item mappings to module mappings
* typecheck/rust-hir-type-check-path.cc (TypeCheckExpr::resolve_root_path): ensure variant
(TypeCheckExpr::resolve_segments): likewise
* typecheck/rust-type-util.cc (query_type): lookup enum's
* util/rust-hir-map.cc (Mappings::insert_hir_enumitem): enum item mappings
(Mappings::lookup_hir_enumitem): likewise
* util/rust-hir-map.h: likewise
gcc/testsuite/ChangeLog:
* rust/compile/issue-850.rs: New test.
* rust/compile/issue-855.rs: New test.
Signed-off-by: Philip Herron <herron.philip@googlemail.com>
Diffstat (limited to 'gcc/rust/backend')
0 files changed, 0 insertions, 0 deletions