From: Pierre-Emmanuel Patry Date: Tue, 25 Mar 2025 18:03:00 +0000 (+0100) Subject: Add new test to highlight namespace for self import X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ce8e35fc28ccc9ade61ff9c83fee55e2673acce8;p=thirdparty%2Fgcc.git 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 --- 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 00000000000..2d9b2ed8e0f --- /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" } +}