https://gcc.gnu.org/g:146dc9483b5597aea3390a3e3641d6c009068525

commit r15-8829-g146dc9483b5597aea3390a3e3641d6c009068525
Author: Arthur Cohen <arthur.co...@embecosm.com>
Date:   Mon Feb 24 12:18:54 2025 +0100

    gccrs: expansion: Expand generic args in generic type path segments
    
    gcc/rust/ChangeLog:
    
            * expand/rust-expand-visitor.cc (ExpandVisitor::visit): Correctly 
visit the generic args
            of a generic type path segment.
    
    gcc/testsuite/ChangeLog:
    
            * rust/compile/issue-2015.rs: New test.

Diff:
---
 gcc/rust/expand/rust-expand-visitor.cc   |  4 +++-
 gcc/testsuite/rust/compile/issue-2015.rs | 19 +++++++++++++++++++
 2 files changed, 22 insertions(+), 1 deletion(-)

diff --git a/gcc/rust/expand/rust-expand-visitor.cc 
b/gcc/rust/expand/rust-expand-visitor.cc
index 1d131b181805..d4db3137565e 100644
--- a/gcc/rust/expand/rust-expand-visitor.cc
+++ b/gcc/rust/expand/rust-expand-visitor.cc
@@ -488,7 +488,9 @@ ExpandVisitor::visit (AST::PathInExpression &path)
 
 void
 ExpandVisitor::visit (AST::TypePathSegmentGeneric &segment)
-{}
+{
+  expand_generic_args (segment.get_generic_args ());
+}
 
 void
 ExpandVisitor::visit (AST::TypePathSegmentFunction &segment)
diff --git a/gcc/testsuite/rust/compile/issue-2015.rs 
b/gcc/testsuite/rust/compile/issue-2015.rs
new file mode 100644
index 000000000000..7789ecda3763
--- /dev/null
+++ b/gcc/testsuite/rust/compile/issue-2015.rs
@@ -0,0 +1,19 @@
+// { dg-additional-options "-frust-compile-until=lowering" }
+
+macro_rules! impl_foo {
+       () => { impl Foo }
+}
+
+pub trait Foo {}
+
+pub trait Bar {
+    type Baz;
+}
+
+pub fn foo(_value: impl Bar<Baz = impl_foo!()>) -> i32 {
+    15
+}
+
+pub fn bar(_value: impl Bar<Baz = impl Foo>) -> i32 {
+    16
+}

Reply via email to