diff --git a/gcc/testsuite/rust/compile/name_resolution11.rs b/gcc/testsuite/rust/compile/name_resolution11.rs new file mode 100644 index 000000000000..a464d2a0fd3e --- /dev/null +++ b/gcc/testsuite/rust/compile/name_resolution11.rs @@ -0,0 +1,7 @@ +// { dg-additional-options "-frust-name-resolution-2.0 -frust-compile-until=lowering" } +fn foo() { + let b = 10; + fn bar() { + let a = foo; + } +} diff --git a/gcc/testsuite/rust/compile/name_resolution12.rs b/gcc/testsuite/rust/compile/name_resolution12.rs new file mode 100644 index 000000000000..9cce31ceb5c2 --- /dev/null +++ b/gcc/testsuite/rust/compile/name_resolution12.rs @@ -0,0 +1,10 @@ +// { dg-additional-options "-frust-name-resolution-2.0 -frust-compile-until=lowering" } + +const TOTO: i32 = 10; + +fn foo() { + let b = 10; + fn bar() { + let e = TOTO; + } +} diff --git a/gcc/testsuite/rust/compile/name_resolution13.rs b/gcc/testsuite/rust/compile/name_resolution13.rs new file mode 100644 index 000000000000..52a152bf51a5 --- /dev/null +++ b/gcc/testsuite/rust/compile/name_resolution13.rs @@ -0,0 +1,9 @@ +// { dg-additional-options "-frust-name-resolution-2.0 -frust-compile-until=lowering" } + +fn foo() { + let b = 10; + fn bar() { + let c = b; + // { dg-error "cannot find value .b. in this scope .E0425." "" { target *-*-* } .-1 } + } +}