diff mbox series

[101/125] gccrs: Add globbing name resolution 2.0 test

Message ID 20240801145809.366388-103-arthur.cohen@embecosm.com
State New
Headers show
Series [001/125] Rust: Make 'tree'-level 'MAIN_NAME_P' work | expand

Commit Message

Arthur Cohen Aug. 1, 2024, 2:57 p.m. UTC
From: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>

Add a few test for globbing to highlight function call ambiguities.

gcc/testsuite/ChangeLog:

	* rust/compile/name_resolution23.rs: New test.
	* rust/compile/name_resolution24.rs: New test.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
---
 .../rust/compile/name_resolution23.rs         | 19 +++++++++++++++++++
 .../rust/compile/name_resolution24.rs         | 15 +++++++++++++++
 2 files changed, 34 insertions(+)
 create mode 100644 gcc/testsuite/rust/compile/name_resolution23.rs
 create mode 100644 gcc/testsuite/rust/compile/name_resolution24.rs
diff mbox series

Patch

diff --git a/gcc/testsuite/rust/compile/name_resolution23.rs b/gcc/testsuite/rust/compile/name_resolution23.rs
new file mode 100644
index 00000000000..50b8e811152
--- /dev/null
+++ b/gcc/testsuite/rust/compile/name_resolution23.rs
@@ -0,0 +1,19 @@ 
+// { dg-options "-frust-name-resolution-2.0" }
+
+mod a {
+    pub mod b {
+        pub fn foo() {}
+        pub fn bar() {}
+        pub fn baz() {}
+    }
+    pub fn baz() {}
+}
+
+use a::b::*;
+use a::baz;
+
+pub fn func() {
+    baz();
+    foo();
+    bar();
+}
diff --git a/gcc/testsuite/rust/compile/name_resolution24.rs b/gcc/testsuite/rust/compile/name_resolution24.rs
new file mode 100644
index 00000000000..f4eb7b2d38f
--- /dev/null
+++ b/gcc/testsuite/rust/compile/name_resolution24.rs
@@ -0,0 +1,15 @@ 
+// { dg-options "-frust-name-resolution-2.0" }
+
+mod a {
+    pub mod b {
+        pub fn baz() {}
+    }
+    pub fn baz() {}
+}
+
+use a::b::*;
+use a::*;
+
+pub fn func() {
+    baz(); // { dg-error ".baz. is ambiguous .E0659." }
+}