diff --git a/gcc/testsuite/rust/compile/name_resolution23.rs b/gcc/testsuite/rust/compile/name_resolution23.rs new file mode 100644 index 000000000000..50b8e8111525 --- /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 000000000000..f4eb7b2d38fd --- /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." } +}