diff options
author | Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com> | 2024-01-24 17:10:42 +0100 |
---|---|---|
committer | Arthur Cohen <arthur.cohen@embecosm.com> | 2024-08-01 16:52:27 +0200 |
commit | e47d270c0d51d7865a8cf2575ffab46352db371b (patch) | |
tree | ce7319c8e4defeb88e1416b6b3c08247a4c5b005 /gcc | |
parent | d5b9dc2354b797f2250a759c06ae140a38b217af (diff) | |
download | gcc-e47d270c0d51d7865a8cf2575ffab46352db371b.zip gcc-e47d270c0d51d7865a8cf2575ffab46352db371b.tar.gz gcc-e47d270c0d51d7865a8cf2575ffab46352db371b.tar.bz2 |
gccrs: Struct are types, not values
We shall search in the right namespace. The correct namespace for struct
is type namespace.
gcc/rust/ChangeLog:
* typecheck/rust-hir-type-check-item.cc (TypeCheckItem::visit): Change
search location for struct types.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/rust/typecheck/rust-hir-type-check-item.cc | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/gcc/rust/typecheck/rust-hir-type-check-item.cc b/gcc/rust/typecheck/rust-hir-type-check-item.cc index 4ab946e..3e504e5 100644 --- a/gcc/rust/typecheck/rust-hir-type-check-item.cc +++ b/gcc/rust/typecheck/rust-hir-type-check-item.cc @@ -279,9 +279,11 @@ TypeCheckItem::visit (HIR::StructStruct &struct_decl) { auto nr_ctx = Resolver2_0::ImmutableNameResolutionContext::get ().resolver (); - auto canonical_path = nr_ctx.values.to_canonical_path ( + auto canonical_path = nr_ctx.types.to_canonical_path ( struct_decl.get_mappings ().get_nodeid ()); + if (!canonical_path.has_value ()) + rust_unreachable (); path = canonical_path.value (); } else |