Skip to content

Commit f59e5a5

Browse files
Disallow warnings when compiling test data (#1623)
Make the test-data compilation binaries reject Cairo warnings so that `make compile-test-data` fails fast on issues like unused variables. Fix the three existing offenders by prefixing unused bindings with `_`. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent aa28d56 commit f59e5a5

5 files changed

Lines changed: 5 additions & 7 deletions

File tree

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
fn run_test(user_len: u32) {
22
let arr: Array<u64> = array![10_u64, 20_u64];
3-
let slice = arr.span().slice(1, user_len);
3+
let _slice = arr.span().slice(1, user_len);
44
}

test_data/programs/libfuncs/array_snapshot_pop_back_clone_offset.cairo

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ fn run_test() -> Span<felt252> {
33
let mut data = data.span();
44

55
assert(*data.pop_front().unwrap() == 7, 0);
6-
let data2 = data.clone();
6+
let _data2 = data.clone();
77

88
assert(*data.pop_back().unwrap() == 193827, 1);
99

test_data/programs/libfuncs/array_snapshot_pop_front_clone_offset.cairo

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ fn run_test() -> Span<felt252> {
33
let mut data = data.span();
44

55
assert(*data.pop_front().unwrap() == 7, 0);
6-
let data2 = data.clone();
6+
let _data2 = data.clone();
77

88
assert(*data.pop_front().unwrap() == 3, 1);
99

test_utils/src/bin/compile-cairo-project.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,7 @@ fn main() -> Result<(), Box<dyn Error>> {
3535
dbb.build()?
3636
};
3737
let crate_inputs = setup_project(&mut db, &args.cairo_path)?;
38-
let diagnostics_reporter = DiagnosticsReporter::stderr()
39-
.with_crates(&crate_inputs)
40-
.allow_warnings();
38+
let diagnostics_reporter = DiagnosticsReporter::stderr().with_crates(&crate_inputs);
4139
let crate_ids = CrateInput::into_crate_ids(&db, crate_inputs);
4240

4341
let program = compile_prepared_db_program_artifact(

test_utils/src/bin/compile-cairo-tests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ fn main() -> Result<(), Box<dyn Error>> {
2222

2323
let compiler = TestCompiler::try_new(
2424
&args.cairo_path,
25-
true,
25+
false,
2626
true,
2727
TestsCompilationConfig {
2828
starknet: args.starknet,

0 commit comments

Comments
 (0)