gcc/testsuite/ChangeLog:
* rust/compile/name_resolution1.rs: New test.
* rust/compile/name_resolution2.rs: New test.
* rust/compile/name_resolution3.rs: New test.
* rust/compile/name_resolution4.rs: New test.
* rust/compile/name_resolution5.rs: New test.
Co-authored-by: GuillaumeGomez <guillaume1.gomez@gmail.com>
--- /dev/null
+fn outer() {
+ inner();
+
+ fn inner() {}
+}
+
+fn main() {
+ outer();
+}
--- /dev/null
+struct Bar;
+
+trait Foo {
+ fn bar(&self) {} // { dg-warning "unused name" }
+}
+
+pub fn outer() {
+ impl Foo for Bar {}
+}
+
+fn main() {
+ Bar.bar();
+}
--- /dev/null
+pub const BAR: u32 = { // { dg-warning "unused name" }
+ let ret = outer();
+
+ const fn outer() -> u32 {
+ 0
+ }
+
+ ret
+};
--- /dev/null
+trait Foo {
+ fn foo(&self) {} // { dg-warning "unused name" }
+}
+
+struct Bar;
+
+pub fn bar() {
+ impl Foo for Bar {}
+}
+
+fn main() {
+ Bar.foo();
+}
--- /dev/null
+fn bar() {
+ foo();
+
+ fn foo() {
+ fn bar2() {
+ foo();
+ }
+
+ bar2();
+ }
+}
+
+fn main() {
+ bar();
+}