-
Notifications
You must be signed in to change notification settings - Fork 740
Expand file tree
/
Copy pathconstant
More file actions
763 lines (582 loc) · 19 KB
/
constant
File metadata and controls
763 lines (582 loc) · 19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
//! > Const
//! > test_runner_name
test_function_diagnostics(expect_diagnostics: false)
//! > function_code
fn foo() {
let _x = MY_CONST + my_module::CONST_IN_MODULE;
let (_y, _z) = FELT_TUPLE;
}
//! > function_name
foo
//! > module_code
const MY_CONST: felt252 = 0x1234;
const FELT_TUPLE: (felt252, felt252) = (1, 2);
const FELT_FIXED_SIZE_ARRAY: [felt252; 3] = [1, 2, 3];
const OTHER_CONST_REF: felt252 = my_module::CONST_IN_MODULE;
const FIVE: u32 = 5;
const NON_ZERO_FIVE: NonZero<u32> = FIVE.try_into().unwrap();
mod my_module {
const CONST_IN_MODULE: felt252 = 1;
}
//! > expected_diagnostics
//! > ==========================================================================
//! > Const diagnostics
//! > test_runner_name
test_function_diagnostics(expect_diagnostics: true)
//! > function_code
fn foo() {}
//! > function_name
foo
//! > module_code
const MY_CONST: MissingType = {
return foo();
Option::<felt252>::Some(0)?
};
const WRONG_TYPE_AND_NOT_LITERAL: bool = 1 + 2;
// Non-corelib impl, preventing the missing operator warning.
impl Felt252Div of Div<felt252> {
fn div(lhs: felt252, rhs: felt252) -> felt252 {
core::felt252_div(lhs, rhs.try_into().unwrap())
}
}
const CALCULATION_NOT_CORELIB_IMPL: felt252 = 8 / 4;
const FAILING_CALC: felt252 = if true {
core::panic_with_felt252('this should fail')
} else {
70
};
/// Copy of `assert` to avoid getting paths from the corelib.
const fn assert(cond: bool) {
if !cond {
core::panic_with_felt252('failed assertion')
}
}
const FUNC_CALC_SUCCESS: () = assert(true);
const FUNC_CALC_FAILURE: () = assert(false);
const VALID_EQ: () = assert(1 == 1);
const VALID_NE: () = assert(1 != 2);
const VALID_LT: () = assert(1_usize < 2);
const VALID_LE: () = assert(1_usize <= 1);
const VALID_GT: () = assert(2_usize > 1);
const VALID_GE: () = assert(1_usize >= 1);
const VALID_DIVREM: () = assert(DivRem::div_rem(5_u8, 2) == (2, 1));
use core::num::traits::Pow;
const VALID_POW_MIN2_0: () = assert((-2_i8).pow(0) == 1);
const VALID_POW_MIN2_3: () = assert((-2_i8).pow(3) == -8);
const VALID_POW_MIN2_6: () = assert((-2_i8).pow(6) == 64);
const VALID_POW_0_0: () = assert(0_felt252.pow(0) == 1);
const VALID_POW_0_1: () = assert(0_felt252.pow(1) == 0);
const VALID_POW_0_2: () = assert(0_felt252.pow(2) == 0);
const VALID_POW_2_0: () = assert(2_felt252.pow(0) == 0b1);
const VALID_POW_2_6: () = assert(2_felt252.pow(6) == 0b1000000);
const VALID_POW_2_10: () = assert(2_felt252.pow(10) == 0b10000000000);
const VALID_NON_ZERO: NonZero<u8> = 1;
const VALID_UNWRAPPED_NON_ZERO: u8 = VALID_NON_ZERO.into();
const FUNC_CALC_SUCCESS_OPTION: felt252 = Some(5).unwrap();
const FUNC_CALC_SUCCESS_RESULT1: felt252 = Result::<_, felt252>::Ok(5).unwrap();
const FUNC_CALC_SUCCESS_RESULT2: felt252 = Result::<felt252, _>::Err(5).unwrap_err();
const FUNC_CALC_STACK_EXCEEDED: felt252 = call_myself();
const fn call_myself() -> felt252 {
call_myself()
}
const ZERO: u64 = 0;
const NON_ZERO_ZERO: NonZero<u64> = my_unwrap(ZERO.try_into());
// To avoid getting corelib filesystem paths.
const fn my_unwrap<T>(v: Option<T>) -> T {
match v {
Some(v) => v,
None => core::panic_with_felt252('bad value'),
}
}
//! > expected_diagnostics
error[E0006]: Type not found.
--> lib.cairo:1:17
const MY_CONST: MissingType = {
^^^^^^^^^^^
error[E2125]: Return statement is not supported outside of functions.
--> lib.cairo:2:5
return foo();
^^^^^^^^^^^^^
error[E2125]: The '?' operator is not supported outside of functions.
--> lib.cairo:3:5
Option::<felt252>::Some(0)?
^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E2311]: Trait has no implementation in context: core::traits::Add::<core::bool>.
--> lib.cairo:6:42
const WRONG_TYPE_AND_NOT_LITERAL: bool = 1 + 2;
^^^^^
error[E2127]: This expression is not supported as constant.
--> lib.cairo:14:47
const CALCULATION_NOT_CORELIB_IMPL: felt252 = 8 / 4;
^^^^^
error[E2128]: Failed to calculate constant.
--> lib.cairo:17:5
core::panic_with_felt252('this should fail')
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E2130]: Failed to calculate constant.
--> lib.cairo:30:31
const FUNC_CALC_FAILURE: () = assert(false);
^^^^^^^^^^^^^
note: In `test::assert`:
--> lib.cairo:25:9
core::panic_with_felt252('failed assertion')
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E2129]: Constant calculation depth exceeded.
--> lib.cairo:59:43
const FUNC_CALC_STACK_EXCEEDED: felt252 = call_myself();
^^^^^^^^^^^^^
error[E2130]: Failed to calculate constant.
--> lib.cairo:66:37
const NON_ZERO_ZERO: NonZero<u64> = my_unwrap(ZERO.try_into());
^^^^^^^^^^^^^^^^^^^^^^^^^^
note: In `test::my_unwrap::<core::zeroable::NonZero::<core::integer::u64>>`:
--> lib.cairo:72:17
None => core::panic_with_felt252('bad value'),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
//! > ==========================================================================
//! > Const of wrong type.
//! > test_runner_name
test_function_diagnostics(expect_diagnostics: true)
//! > function_code
fn foo() {}
//! > function_name
foo
//! > module_code
const DEFAULT_VAR: bool = 1;
//! > expected_diagnostics
error[E2311]: Mismatched types. The type `core::bool` cannot be created from a numeric literal.
--> lib.cairo:1:27
const DEFAULT_VAR: bool = 1;
^
//! > ==========================================================================
//! > Const of unknown types.
//! > test_runner_name
test_function_diagnostics(expect_diagnostics: true)
//! > function_code
fn foo() {}
//! > function_name
foo
//! > module_code
const FULLY_UNKNOWN: _ = 1_u8;
const FIXED_SIZED_TYPE_UNKNOWN: [_; 2] = [1_u8, 2_u8];
//! > expected_diagnostics
error[E2126]: Constant type must not depend on its value.
--> lib.cairo:1:22
const FULLY_UNKNOWN: _ = 1_u8;
^
error[E2126]: Constant type must not depend on its value.
--> lib.cairo:2:33
const FIXED_SIZED_TYPE_UNKNOWN: [_; 2] = [1_u8, 2_u8];
^^^^^^
//! > ==========================================================================
//! > Const of negative values out of range.
//! > test_runner_name
test_function_diagnostics(expect_diagnostics: true)
//! > function_code
fn foo() {}
//! > function_name
foo
//! > module_code
const B: u8 = -1;
//! > expected_diagnostics
error[E2008]: The value does not fit within the range of type core::integer::u8.
--> lib.cairo:1:15
const B: u8 = -1;
^^
//! > ==========================================================================
//! > Const reference to itself.
//! > test_runner_name
test_function_diagnostics(expect_diagnostics: true)
//! > function_code
fn foo() {}
//! > function_name
foo
//! > module_code
const A: i8 = A;
const B: i8 = C;
const C: i8 = B;
//! > expected_diagnostics
error[E2024]: Cycle detected while resolving 'const' items.
--> lib.cairo:1:1
const A: i8 = A;
^^^^^^^^^^^^^^^^
error[E2024]: Cycle detected while resolving 'const' items.
--> lib.cairo:2:1
const B: i8 = C;
^^^^^^^^^^^^^^^^
error[E2024]: Cycle detected while resolving 'const' items.
--> lib.cairo:3:1
const C: i8 = B;
^^^^^^^^^^^^^^^^
//! > ==========================================================================
//! > const literal values
//! > test_runner_name
test_function_diagnostics(expect_diagnostics: true)
//! > function_code
fn foo() -> (felt252, felt252, u256, i8) {
(FELT_WRAPAROUND_OVER, FELT_WRAPAROUND_UNDER, U256_CALCULATION, BASIC_CALCULATION)
}
//! > function_name
foo
//! > module_code
const UNSIGNED_VAR: u8 = 256;
const SIGNED_VAR: i8 = 128;
const IN_RANGE_NEGATIVE1: i8 = -0x80;
const IN_RANGE_NEGATIVE2: i16 = -5;
const OUT_OF_RANGE_NEGATIVE1: i8 = -0x81;
const OUT_OF_RANGE_NEGATIVE2: i16 = -0x8001;
const ZERO_NON_ZERO: NonZero<u8> = 0;
const BASIC_CALCULATION: i8 = 120 + 7;
const CALCULATION_WITH_OVERFLOW: i8 = 120 + 10;
const CALCULATION_WITH_DIVISION: u8 = 120 / 0;
const FELT_WRAPAROUND_OVER: felt252 =
0x800000000000011000000000000000000000000000000000000000000000000
+ 2;
const FELT_WRAPAROUND_UNDER: felt252 =
-0x800000000000011000000000000000000000000000000000000000000000000
- 2;
const U256_VALUE: u256 = 0x180000000000000000000000000000001;
const U256_CALCULATION: u256 = U256_VALUE * 8;
struct ComplexStruct {
a: u8,
b: i8,
c: i16,
d: NonZero<u8>,
e: bool,
}
const COMPLEX_STRUCT: ComplexStruct = ComplexStruct {
a: 1, b: {
IN_RANGE_NEGATIVE1
}, c: OUT_OF_RANGE_NEGATIVE2, d: 0, e: true,
};
const CONST_MEMBER: u8 = COMPLEX_STRUCT.a;
//! > expected_diagnostics
error[E2008]: The value does not fit within the range of type core::integer::u8.
--> lib.cairo:1:26
const UNSIGNED_VAR: u8 = 256;
^^^
error[E2008]: The value does not fit within the range of type core::integer::i8.
--> lib.cairo:2:24
const SIGNED_VAR: i8 = 128;
^^^
error[E2008]: The value does not fit within the range of type core::integer::i8.
--> lib.cairo:5:36
const OUT_OF_RANGE_NEGATIVE1: i8 = -0x81;
^^^^^
error[E2008]: The value does not fit within the range of type core::integer::i16.
--> lib.cairo:6:37
const OUT_OF_RANGE_NEGATIVE2: i16 = -0x8001;
^^^^^^^
error[E2008]: The value does not fit within the range of type core::zeroable::NonZero::<core::integer::u8>.
--> lib.cairo:7:36
const ZERO_NON_ZERO: NonZero<u8> = 0;
^
error[E2008]: The value does not fit within the range of type core::integer::i8.
--> lib.cairo:9:39
const CALCULATION_WITH_OVERFLOW: i8 = 120 + 10;
^^^^^^^^
error[E2131]: Division by zero.
--> lib.cairo:10:39
const CALCULATION_WITH_DIVISION: u8 = 120 / 0;
^^^^^^^
error[E2008]: The value does not fit within the range of type core::zeroable::NonZero::<core::integer::u8>.
--> lib.cairo:31:38
}, c: OUT_OF_RANGE_NEGATIVE2, d: 0, e: true,
^
//! > ==========================================================================
//! > const in block
//! > test_runner_name
test_function_diagnostics(expect_diagnostics: true)
//! > function_code
fn foo() -> () {
{
const X: u8 = 2;
}
let y = X;
}
//! > function_name
foo
//! > expected_diagnostics
warning[E2070]: Unused constant. Consider ignoring by prefixing with `_`.
--> lib.cairo:3:15
const X: u8 = 2;
^
error[E0006]: Identifier not found.
--> lib.cairo:5:13
let y = X;
^
warning[E0001]: Unused variable. Consider ignoring by prefixing with `_`.
--> lib.cairo:5:9
let y = X;
^
//! > ==========================================================================
//! > multiple definitions of the same const
//! > test_runner_name
test_function_diagnostics(expect_diagnostics: true)
//! > function_code
fn foo() -> () {
const A: u8 = 1;
const A: u8 = 2;
const B: u8 = 3;
let B = 4;
let C = 5;
const C: u8 = 6;
{
const D: u8 = 7;
const D: u8 = 8;
const E: u8 = 9;
let E = 10;
let F = 11;
const F: u8 = 12;
}
}
//! > function_name
foo
//! > expected_diagnostics
error[E2072]: Multiple definitions of constant "A".
--> lib.cairo:3:11
const A: u8 = 2;
^
error[E2073]: Multiple definitions of identifier 'B' as constant and variable.
--> lib.cairo:5:9
let B = 4;
^
error[E2073]: Multiple definitions of identifier 'C' as constant and variable.
--> lib.cairo:7:11
const C: u8 = 6;
^
error[E2072]: Multiple definitions of constant "D".
--> lib.cairo:10:15
const D: u8 = 8;
^
error[E2073]: Multiple definitions of identifier 'E' as constant and variable.
--> lib.cairo:12:13
let E = 10;
^
error[E2073]: Multiple definitions of identifier 'F' as constant and variable.
--> lib.cairo:14:15
const F: u8 = 12;
^
warning[E2070]: Unused constant. Consider ignoring by prefixing with `_`.
--> lib.cairo:10:15
const D: u8 = 8;
^
warning[E0001]: Unused variable. Consider ignoring by prefixing with `_`.
--> lib.cairo:12:13
let E = 10;
^
warning[E2070]: Unused constant. Consider ignoring by prefixing with `_`.
--> lib.cairo:14:15
const F: u8 = 12;
^
warning[E2070]: Unused constant. Consider ignoring by prefixing with `_`.
--> lib.cairo:3:11
const A: u8 = 2;
^
warning[E0001]: Unused variable. Consider ignoring by prefixing with `_`.
--> lib.cairo:5:9
let B = 4;
^
warning[E2070]: Unused constant. Consider ignoring by prefixing with `_`.
--> lib.cairo:7:11
const C: u8 = 6;
^
//! > ==========================================================================
//! > Usage of non-consts in consts
//! > test_runner_name
test_function_diagnostics(expect_diagnostics: true)
//! > function_code
fn foo(param: u8) -> () {
const A: u8 = param;
let local: u8 = 1;
const B: u8 = local;
const _C: u8 = A + B;
}
//! > function_name
foo
//! > expected_diagnostics
error[E2127]: This expression is not supported as constant.
--> lib.cairo:2:19
const A: u8 = param;
^^^^^
error[E2127]: This expression is not supported as constant.
--> lib.cairo:4:19
const B: u8 = local;
^^^^^
//! > ==========================================================================
//! > Starknet consts diagnostics
//! > test_runner_name
test_function_diagnostics(expect_diagnostics: true)
//! > function_code
fn foo() {}
//! > function_name
foo
//! > module_code
const ADDRESS: starknet::ContractAddress = my_unwrap((-1).try_into());
const CLASS_HASH: starknet::ClassHash = my_unwrap((-1).try_into());
// To avoid getting corelib filesystem paths.
const fn my_unwrap<T>(v: Option<T>) -> T {
match v {
Some(v) => v,
None => core::panic_with_felt252('bad value'),
}
}
//! > expected_diagnostics
error[E2130]: Failed to calculate constant.
--> lib.cairo:1:44
const ADDRESS: starknet::ContractAddress = my_unwrap((-1).try_into());
^^^^^^^^^^^^^^^^^^^^^^^^^^
note: In `test::my_unwrap::<core::starknet::contract_address::ContractAddress>`:
--> lib.cairo:8:17
None => core::panic_with_felt252('bad value'),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E2130]: Failed to calculate constant.
--> lib.cairo:2:41
const CLASS_HASH: starknet::ClassHash = my_unwrap((-1).try_into());
^^^^^^^^^^^^^^^^^^^^^^^^^^
note: In `test::my_unwrap::<core::starknet::class_hash::ClassHash>`:
--> lib.cairo:8:17
None => core::panic_with_felt252('bad value'),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
//! > ==========================================================================
//! > Multiple `if let` conditions.
//! > test_runner_name
test_function_diagnostics(expect_diagnostics: false)
//! > function_code
fn foo() {
const A: Option<Option<Option<felt252>>> = Some(Some(Some(1_felt252)));
const _B: felt252 = if let Some(a) = A && let Some(b) = a && let Some(c) = b {
c
} else {
0
};
}
//! > function_name
foo
//! > expected_diagnostics
//! > ==========================================================================
//! > Casts from felt252.
//! > test_runner_name
test_function_diagnostics(expect_diagnostics: false)
//! > function_code
fn foo() {}
//! > function_name
foo
//! > module_code
/// Copy of `assert` to avoid getting paths from the corelib.
const fn assert(cond: bool) {
if !cond {
core::panic_with_felt252('failed assertion')
}
}
const V: felt252 = 0x800000000000011000000000000000000000000000000000000000000000000;
const V_AS_I8: () = assert(V.try_into() == Some(-1_i8));
const V_AS_I16: () = assert(V.try_into() == Some(-1_i16));
const V_AS_I32: () = assert(V.try_into() == Some(-1_i32));
const V_AS_I64: () = assert(V.try_into() == Some(-1_i64));
const V_AS_I128: () = assert(V.try_into() == Some(-1_i128));
//! > expected_diagnostics
//! > ==========================================================================
//! > Const logical operators: short-circuit and truth table
//! > test_runner_name
test_function_diagnostics(expect_diagnostics: false)
//! > function_code
fn foo() {}
//! > function_name
foo
//! > module_code
const fn assert(cond: bool) {
if !cond {
core::panic_with_felt252('failed assertion')
}
}
const fn boom() -> bool {
core::panic_with_felt252('boom')
}
const AND_TF: () = assert(!(true && false));
const OR_FT: () = assert(false || true);
const AND_SHORT_CIRCUIT: () = assert(!(false && boom()));
const OR_SHORT_CIRCUIT: () = assert(true || boom());
//! > expected_diagnostics
//! > ==========================================================================
//! > Evaluate const functions with const impls.
//! > test_runner_name
test_function_diagnostics(expect_diagnostics: true)
//! > function_code
fn foo() {}
//! > function_name
foo
//! > module_code
trait Foo {
const VALUE: felt252;
}
impl AFoo of Foo {
const VALUE: felt252 = 42;
}
impl AnotherFoo<impl F: Foo> of Foo {
const VALUE: felt252 = F::VALUE + 1;
}
//! > expected_diagnostics
error[E2127]: This expression is not supported as constant.
--> lib.cairo:8:28
const VALUE: felt252 = F::VALUE + 1;
^^^^^^^^^^^^
//! > ==========================================================================
//! > Use const impls as other consts.
//! > test_runner_name
test_function_diagnostics(expect_diagnostics: false)
//! > function_code
fn foo() {}
//! > function_name
foo
//! > module_code
trait Foo {
const VALUE: felt252;
}
impl AFoo of Foo {
const VALUE: felt252 = 42;
}
impl AnotherFoo<impl F: Foo> of Foo {
const VALUE: felt252 = F::VALUE;
}
//! > expected_diagnostics
//! > ==========================================================================
//! > User-defined extern const fn in constant expression.
//! > test_runner_name
test_function_diagnostics(expect_diagnostics: true)
//! > function_code
fn foo() {}
//! > function_name
foo
//! > module_code
extern const fn f() -> felt252 nopanic;
const X: felt252 = f();
//! > expected_diagnostics
error[E2127]: This expression is not supported as constant.
--> lib.cairo:2:20
const X: felt252 = f();
^^^
//! > ==========================================================================
//! > Statement-level const struct literal with missing field.
//! > test_runner_name
test_function_diagnostics(expect_diagnostics: true)
//! > function_code
fn foo() {
const X: S = S { a: 1 };
}
//! > function_name
foo
//! > module_code
struct S {
a: felt252,
b: felt252,
}
//! > expected_diagnostics
error[E0003]: Missing member "b".
--> lib.cairo:6:18
const X: S = S { a: 1 };
^^^^^^^^^^
warning[E2070]: Unused constant. Consider ignoring by prefixing with `_`.
--> lib.cairo:6:11
const X: S = S { a: 1 };
^