Sitelet https://github.com/starkware-libs/cairo/commit/f8af227a70c59d7cbdceb2302f68b021887d2b8c
Skip to content

Commit f8af227

Browse files
committed
feat(semantic): Warn when an extern type/function is declared outside the corelib.
Adds the `extern_outside_corelib` warning (E2201), emitted on any `extern type` or `extern fn` declared outside the core crate. Silenceable per-item with `#[allow(extern_outside_corelib)]`; internal tests that declare externs are annotated accordingly.
1 parent 6296ede commit f8af227

78 files changed

Lines changed: 547 additions & 100 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎crates/cairo-lang-lowering/src/analysis/test_data/equality‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1236,6 +1236,7 @@ fn foo(a: felt252, b: felt252) -> Array<felt252> {
12361236
foo
12371237

12381238
//! > module_code
1239+
#[allow(extern_outside_corelib)]
12391240
extern fn use_arr(x: @Array<felt252>) nopanic;
12401241

12411242
//! > semantic_diagnostics
@@ -1350,6 +1351,7 @@ fn foo(a: felt252, b: felt252) {
13501351
foo
13511352

13521353
//! > module_code
1354+
#[allow(extern_outside_corelib)]
13531355
extern fn use_snap_felt(x: @felt252) nopanic;
13541356

13551357
//! > semantic_diagnostics
@@ -1457,6 +1459,7 @@ fn foo(a: felt252, b: felt252) {
14571459
foo
14581460

14591461
//! > module_code
1462+
#[allow(extern_outside_corelib)]
14601463
extern fn use_snap_felt(x: @felt252) nopanic;
14611464

14621465
//! > semantic_diagnostics
@@ -1552,6 +1555,7 @@ fn foo(mut arr: Array<felt252>) {
15521555
foo
15531556

15541557
//! > module_code
1558+
#[allow(extern_outside_corelib)]
15551559
extern fn use_snap_felt(x: @felt252) nopanic;
15561560

15571561
//! > semantic_diagnostics
@@ -1943,6 +1947,7 @@ fn foo(x: felt252, y: felt252) {
19431947
foo
19441948

19451949
//! > module_code
1950+
#[allow(extern_outside_corelib)]
19461951
extern fn use_boxes(a: Box<Option<felt252>>, b: Box<Option<felt252>>) nopanic;
19471952

19481953
//! > semantic_diagnostics

0 commit comments

Comments
 (0)