|
4 | 4 | test_expand_plugin(expect_diagnostics: false) |
5 | 5 |
|
6 | 6 | //! > cairo_code |
| 7 | +#[feature("deprecated-panic-with")] |
7 | 8 | #[panic_with('1', foo_improved)] |
8 | 9 | extern fn foo(a: felt252, ref b: other) -> Option<()> implicits(RangeCheck, GasBuiltin) nopanic; |
9 | 10 |
|
| 11 | +#[feature("deprecated-panic-with")] |
10 | 12 | #[panic_with('2', bar_changed)] |
11 | 13 | extern fn bar() -> Result<felt252, Err> nopanic; |
12 | 14 |
|
| 15 | +#[feature("deprecated-panic-with")] |
13 | 16 | #[panic_with('3', non_extern_stuff)] |
14 | 17 | fn non_extern(_a: some_type) -> Option<(felt252, other)> nopanic { |
15 | 18 | (4, 56) |
16 | 19 | } |
17 | 20 |
|
| 21 | +#[feature("deprecated-panic-with")] |
18 | 22 | #[panic_with('4', generic_panic)] |
19 | 23 | extern fn generic<T>(t: T, v: felt252) -> Result<T, Err> nopanic; |
20 | 24 |
|
| 25 | +#[feature("deprecated-panic-with")] |
21 | 26 | #[panic_with('5', wrapped_possibly_panic)] |
22 | 27 | fn possibly_panic() -> Result<felt252, Err> { |
23 | 28 | Result::<felt252, Err>::Ok(1) |
24 | 29 | } |
25 | 30 |
|
26 | 31 | //! > expanded_cairo_code |
| 32 | +#[feature("deprecated-panic-with")] |
27 | 33 | #[panic_with('1', foo_improved)] |
28 | 34 | extern fn foo(a: felt252, ref b: other) -> Option<()> implicits(RangeCheck, GasBuiltin) nopanic; |
29 | 35 |
|
| 36 | +#[feature("deprecated-panic-with")] |
30 | 37 | #[panic_with('2', bar_changed)] |
31 | 38 | extern fn bar() -> Result<felt252, Err> nopanic; |
32 | 39 |
|
| 40 | +#[feature("deprecated-panic-with")] |
33 | 41 | #[panic_with('3', non_extern_stuff)] |
34 | 42 | fn non_extern(_a: some_type) -> Option<(felt252, other)> nopanic { |
35 | 43 | (4, 56) |
36 | 44 | } |
37 | 45 |
|
| 46 | +#[feature("deprecated-panic-with")] |
38 | 47 | #[panic_with('4', generic_panic)] |
39 | 48 | extern fn generic<T>(t: T, v: felt252) -> Result<T, Err> nopanic; |
40 | 49 |
|
| 50 | +#[feature("deprecated-panic-with")] |
41 | 51 | #[panic_with('5', wrapped_possibly_panic)] |
42 | 52 | fn possibly_panic() -> Result<felt252, Err> { |
43 | 53 | Result::<felt252, Err>::Ok(1) |
@@ -111,24 +121,48 @@ extern fn bad_ret_type(_a: some_type) -> felt252 nopanic; |
111 | 121 | extern fn bar() -> Result<felt252, Err> nopanic; |
112 | 122 |
|
113 | 123 | //! > expected_diagnostics |
| 124 | +error: Usage of deprecated macro `panic_with` with no `#[feature("deprecated-panic-with")]` attribute. Use simple calculations instead, as these are supported in const context. |
| 125 | + --> test_src/lib.cairo:1:1 |
| 126 | +#[panic_with(123, foo_bad_err_code)] |
| 127 | +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 128 | + |
| 129 | + |
114 | 130 | error: Failed to extract panic data attribute |
115 | 131 | --> test_src/lib.cairo:1:1 |
116 | 132 | #[panic_with(123, foo_bad_err_code)] |
117 | 133 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
118 | 134 |
|
119 | 135 |
|
| 136 | +error: Usage of deprecated macro `panic_with` with no `#[feature("deprecated-panic-with")]` attribute. Use simple calculations instead, as these are supported in const context. |
| 137 | + --> test_src/lib.cairo:4:1 |
| 138 | +#[panic_with(missing_args)] |
| 139 | +^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 140 | + |
| 141 | + |
120 | 142 | error: Failed to extract panic data attribute |
121 | 143 | --> test_src/lib.cairo:4:1 |
122 | 144 | #[panic_with(missing_args)] |
123 | 145 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
124 | 146 |
|
125 | 147 |
|
| 148 | +error: Usage of deprecated macro `panic_with` with no `#[feature("deprecated-panic-with")]` attribute. Use simple calculations instead, as these are supported in const context. |
| 149 | + --> test_src/lib.cairo:7:1 |
| 150 | +#[panic_with(missing_args)] |
| 151 | +^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 152 | + |
| 153 | + |
126 | 154 | error: Currently only wrapping functions returning an Option<T> or Result<T, E> |
127 | 155 | --> test_src/lib.cairo:8:39 |
128 | 156 | extern fn bad_ret_type(_a: some_type) -> felt252 nopanic; |
129 | 157 | ^^^^^^^^^^ |
130 | 158 |
|
131 | 159 |
|
| 160 | +error: Usage of deprecated macro `panic_with` with no `#[feature("deprecated-panic-with")]` attribute. Use simple calculations instead, as these are supported in const context. |
| 161 | + --> test_src/lib.cairo:10:1 |
| 162 | +#[panic_with('2', bar_changed)] |
| 163 | +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 164 | + |
| 165 | + |
132 | 166 | error: `#[panic_with]` cannot be applied multiple times to the same item. |
133 | 167 | --> test_src/lib.cairo:11:1 |
134 | 168 | #[panic_with('3', bar_changed)] |
|
0 commit comments