Skip to content

Commit

Permalink
Add globbing name resolution 2.0 test
Browse files Browse the repository at this point in the history
Add a few test for globbing to highlight function call ambiguities.

gcc/testsuite/ChangeLog:

	* rust/compile/name_resolution23.rs: New test.
	* rust/compile/name_resolution24.rs: New test.

Signed-off-by: Pierre-Emmanuel Patry <[email protected]>
  • Loading branch information
P-E-P committed Mar 26, 2024
1 parent db7d499 commit 2ac4591
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
19 changes: 19 additions & 0 deletions gcc/testsuite/rust/compile/name_resolution23.rs
Original file line number Diff line number Diff line change
@@ -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();
}
15 changes: 15 additions & 0 deletions gcc/testsuite/rust/compile/name_resolution24.rs
Original file line number Diff line number Diff line change
@@ -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." }
}

0 comments on commit 2ac4591

Please sign in to comment.