forked from Rust-GCC/gccrs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add multiple regression test in name resolution
Local variables and functions or global variables have different resolution when binded to a variable. This was not covered before, even though it was handled by the new name resolution. This commit highlight this behavior from the new name resolution mechanism. gcc/testsuite/ChangeLog: * rust/compile/name_resolution11.rs: New test. * rust/compile/name_resolution12.rs: New test. * rust/compile/name_resolution13.rs: New test. Signed-off-by: Pierre-Emmanuel Patry <[email protected]>
- Loading branch information
Showing
3 changed files
with
26 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 } | ||
} | ||
} |