https://gcc.gnu.org/g:405a294780dd12f242bb96540b1251091f13b051

commit r15-9097-g405a294780dd12f242bb96540b1251091f13b051
Author: Pierre-Emmanuel Patry <pierre-emmanuel.pa...@embecosm.com>
Date:   Tue Mar 25 19:03:00 2025 +0100

    gccrs: Add new test to highlight namespace for self import
    
    gcc/testsuite/ChangeLog:
    
            * rust/compile/self_import_namespace.rs: New test.
    
    Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.pa...@embecosm.com>

Diff:
---
 gcc/testsuite/rust/compile/self_import_namespace.rs | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/gcc/testsuite/rust/compile/self_import_namespace.rs 
b/gcc/testsuite/rust/compile/self_import_namespace.rs
new file mode 100644
index 000000000000..2d9b2ed8e0fc
--- /dev/null
+++ b/gcc/testsuite/rust/compile/self_import_namespace.rs
@@ -0,0 +1,14 @@
+// { dg-additional-options "-frust-name-resolution-2.0" }
+
+mod bar {
+    pub mod foo {}
+    pub fn foo() {}
+}
+
+// This only imports the module `foo`. The function `foo` lives in
+// the value namespace and is not imported.
+use bar::foo::{self};
+
+fn main() {
+    foo(); // { dg-error "expected value" }
+}

Reply via email to