diff options
author | Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com> | 2025-03-25 19:03:00 +0100 |
---|---|---|
committer | P-E-P <32375388+P-E-P@users.noreply.github.com> | 2025-03-27 17:29:15 +0000 |
commit | ce8e35fc28ccc9ade61ff9c83fee55e2673acce8 (patch) | |
tree | aa22ca727ffd070bc4723eb761b97a2263987ae1 | |
parent | 45f70e36a90f895e4d5a0070e77512c4798ba308 (diff) | |
download | gcc-ce8e35fc28ccc9ade61ff9c83fee55e2673acce8.zip gcc-ce8e35fc28ccc9ade61ff9c83fee55e2673acce8.tar.gz gcc-ce8e35fc28ccc9ade61ff9c83fee55e2673acce8.tar.bz2 |
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.patry@embecosm.com>
-rw-r--r-- | gcc/testsuite/rust/compile/self_import_namespace.rs | 14 |
1 files changed, 14 insertions, 0 deletions
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 0000000..2d9b2ed --- /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" } +} |