Skip to content

Commit ce8e35f

Browse files
committed
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>
1 parent 45f70e3 commit ce8e35f

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// { dg-additional-options "-frust-name-resolution-2.0" }
2+
3+
mod bar {
4+
pub mod foo {}
5+
pub fn foo() {}
6+
}
7+
8+
// This only imports the module `foo`. The function `foo` lives in
9+
// the value namespace and is not imported.
10+
use bar::foo::{self};
11+
12+
fn main() {
13+
foo(); // { dg-error "expected value" }
14+
}

0 commit comments

Comments
 (0)