Skip to content

Commit

Permalink
Add execution test for name resolution 2.0
Browse files Browse the repository at this point in the history
We already have some compile tests but it lacked an execution test to
ensure everything compiles correctly to the correct value.

gcc/testsuite/ChangeLog:

	* rust/execute/torture/name_resolution.rs: New test.

Signed-off-by: Pierre-Emmanuel Patry <[email protected]>
  • Loading branch information
P-E-P committed Dec 1, 2023
1 parent dc962fa commit e876ff5
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions gcc/testsuite/rust/execute/torture/name_resolution.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// { dg-additional-options "-frust-name-resolution-2.0" }
// { dg-output "Value is 10\r*\n" }

const BAZ: i32 = 10;

extern "C" {
fn printf(s: *const i8, ...);
}

fn foo() {
fn bar() {
let e = BAZ;
unsafe {
printf("Value is %i\n" as *const str as *const i8, e);
}
}

bar();
}

fn main() -> i32 {
foo();
0
}

0 comments on commit e876ff5

Please sign in to comment.