aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/resolve
diff options
context:
space:
mode:
authorArthur Cohen <arthur.cohen@embecosm.com>2024-12-25 18:13:43 +0000
committerArthur Cohen <arthur.cohen@embecosm.com>2025-03-21 12:55:44 +0100
commit161b9e9828b84b75f64aa0ffdadcefe920c1ed0d (patch)
tree2dd6f061cdd0e2c4f82adc2fc41e732b9c08d13a /gcc/rust/resolve
parentcd8547f85e53b42eff5a7c7572b466c023c75daf (diff)
downloadgcc-161b9e9828b84b75f64aa0ffdadcefe920c1ed0d.zip
gcc-161b9e9828b84b75f64aa0ffdadcefe920c1ed0d.tar.gz
gcc-161b9e9828b84b75f64aa0ffdadcefe920c1ed0d.tar.bz2
gccrs: tychk: Add more support for additional trait bounds in functions
This commit correctly lowers and typechecks parenthesized types, which are used for trait objects with additional bounds. gcc/rust/ChangeLog: * resolve/rust-ast-resolve-type.cc (ResolveType::visit): New visitor to handle ParenthesizedType. * resolve/rust-ast-resolve-type.h: Likewise. * typecheck/rust-hir-type-check-type.cc (TypeCheckType::visit): Likewise. * typecheck/rust-hir-type-check-type.h: Likewise. gcc/testsuite/ChangeLog: * rust/compile/auto_traits2.rs: New test. * rust/compile/auto_traits3.rs: New test. * rust/compile/nr2/exclude: Add auto_traits2 test.
Diffstat (limited to 'gcc/rust/resolve')
-rw-r--r--gcc/rust/resolve/rust-ast-resolve-type.cc6
-rw-r--r--gcc/rust/resolve/rust-ast-resolve-type.h3
2 files changed, 9 insertions, 0 deletions
diff --git a/gcc/rust/resolve/rust-ast-resolve-type.cc b/gcc/rust/resolve/rust-ast-resolve-type.cc
index cb5a18d..1d004b1 100644
--- a/gcc/rust/resolve/rust-ast-resolve-type.cc
+++ b/gcc/rust/resolve/rust-ast-resolve-type.cc
@@ -51,6 +51,12 @@ ResolveType::visit (AST::TraitObjectType &type)
}
void
+ResolveType::visit (AST::ParenthesisedType &type)
+{
+ resolved_node = ResolveType::go (*type.get_type_in_parens ());
+}
+
+void
ResolveType::visit (AST::ReferenceType &type)
{
resolved_node = ResolveType::go (type.get_type_referenced ());
diff --git a/gcc/rust/resolve/rust-ast-resolve-type.h b/gcc/rust/resolve/rust-ast-resolve-type.h
index 518c0d8..5e8cdb1 100644
--- a/gcc/rust/resolve/rust-ast-resolve-type.h
+++ b/gcc/rust/resolve/rust-ast-resolve-type.h
@@ -24,6 +24,7 @@
#include "rust-diagnostics.h"
#include "rust-hir-map.h"
#include "rust-path.h"
+#include "rust-type.h"
#include "util/rust-hir-map.h"
namespace Rust {
@@ -143,6 +144,8 @@ public:
void visit (AST::TraitObjectType &type) override;
+ void visit (AST::ParenthesisedType &type) override;
+
void visit (AST::SliceType &type) override;
private: