Skip to content

Commit 02a2b19

Browse files
authored
Remove unused rust impl for formatting dis output (#7660)
* Remove unused rust impl for formatting dis output * remove `examples/dis.rs` * Added tests * Update lock * Try to set snapshot dir * Remove verbose flag * Regenerate snapshots after #7711 * Revert "Bump insta from 1.46.3 to 1.47.2 (#7706)" This reverts commit e6d9ea6. * Debug info * Show diff as well * Show debug faster * CI: true env * Recert CI * Add `CI: true` in ci emv * Reapply "Bump insta from 1.46.3 to 1.47.2 (#7706)" This reverts commit 693ca8c. * simplify macro * trim on function side * Force insta workspace root * fix merge
1 parent ae7ff9c commit 02a2b19

30 files changed

Lines changed: 474 additions & 1023 deletions

.github/workflows/ci.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ env:
3434
CARGO_PROFILE_RELEASE_DEBUG: 0
3535
CARGO_TERM_COLOR: always
3636
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true # TODO: Remove on 2026/06/02
37+
CI: true
3738

3839
jobs:
3940
determine_changes:
@@ -111,7 +112,9 @@ jobs:
111112
uses: ./.github/actions/install-macos-deps
112113

113114
- name: run rust tests
114-
run: cargo test --workspace ${{ env.WORKSPACE_EXCLUDES }} --verbose --features threading ${{ env.CARGO_ARGS }}
115+
run: cargo test --workspace ${{ env.WORKSPACE_EXCLUDES }} --features threading ${{ env.CARGO_ARGS }}
116+
env:
117+
INSTA_WORKSPACE_ROOT: ${{ github.workspace }}
115118

116119
- run: cargo doc --locked
117120
if: runner.os == 'Linux'

Cargo.lock

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/codegen/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ unicode_names2 = { workspace = true }
3333

3434
[dev-dependencies]
3535
ruff_python_parser = { workspace = true }
36-
insta = { workspace = true }
3736

3837
[lints]
3938
workspace = true

crates/codegen/src/compile.rs

Lines changed: 0 additions & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -12275,26 +12275,6 @@ def f(sys, os, file):
1227512275
})
1227612276
}
1227712277

12278-
macro_rules! assert_dis_snapshot {
12279-
($value:expr) => {
12280-
insta::assert_snapshot!(
12281-
insta::internals::AutoName,
12282-
$value.display_expand_code_objects().to_string(),
12283-
stringify!($value)
12284-
)
12285-
};
12286-
}
12287-
12288-
#[test]
12289-
fn test_if_ors() {
12290-
assert_dis_snapshot!(compile_exec(
12291-
"\
12292-
if True or False or False:
12293-
pass
12294-
"
12295-
));
12296-
}
12297-
1229812278
#[test]
1229912279
fn test_trace_assert_true_try_pair() {
1230012280
let trace = compile_exec_late_cfg_trace(
@@ -12529,44 +12509,6 @@ def f(self):
1252912509
);
1253012510
}
1253112511

12532-
#[test]
12533-
fn test_if_ands() {
12534-
assert_dis_snapshot!(compile_exec(
12535-
"\
12536-
if True and False and False:
12537-
pass
12538-
"
12539-
));
12540-
}
12541-
12542-
#[test]
12543-
fn test_if_mixed() {
12544-
assert_dis_snapshot!(compile_exec(
12545-
"\
12546-
if (True and False) or (False and True):
12547-
pass
12548-
"
12549-
));
12550-
}
12551-
12552-
#[test]
12553-
fn test_nested_bool_op() {
12554-
assert_dis_snapshot!(compile_exec(
12555-
"\
12556-
x = Test() and False or False
12557-
"
12558-
));
12559-
}
12560-
12561-
#[test]
12562-
fn test_const_bool_not_op() {
12563-
assert_dis_snapshot!(compile_exec_optimized(
12564-
"\
12565-
x = not True
12566-
"
12567-
));
12568-
}
12569-
1257012512
#[test]
1257112513
fn test_plain_constant_bool_op_folds_to_selected_operand() {
1257212514
let code = compile_exec(
@@ -12840,24 +12782,6 @@ def f(self, mod):
1284012782
);
1284112783
}
1284212784

12843-
#[test]
12844-
fn test_nested_double_async_with() {
12845-
assert_dis_snapshot!(compile_exec(
12846-
"\
12847-
async def test():
12848-
for stop_exc in (StopIteration('spam'), StopAsyncIteration('ham')):
12849-
with self.subTest(type=type(stop_exc)):
12850-
try:
12851-
async with egg():
12852-
raise stop_exc
12853-
except Exception as ex:
12854-
self.assertIs(ex, stop_exc)
12855-
else:
12856-
self.fail(f'{stop_exc} was suppressed')
12857-
"
12858-
));
12859-
}
12860-
1286112785
#[test]
1286212786
fn test_scope_exit_instructions_keep_line_numbers() {
1286312787
let code = compile_exec(
@@ -14006,20 +13930,6 @@ def f(expected_ns, namespace):
1400613930
}
1400713931
}
1400813932

14009-
#[test]
14010-
fn test_bare_function_annotations_check_attribute_and_subscript_expressions() {
14011-
assert_dis_snapshot!(compile_exec(
14012-
"\
14013-
def f(one: int):
14014-
int.new_attr: int
14015-
[list][0].new_attr: [int, str]
14016-
my_lst = [1]
14017-
my_lst[one]: int
14018-
return my_lst
14019-
"
14020-
));
14021-
}
14022-
1402313933
#[test]
1402413934
fn test_non_simple_bare_name_annotation_does_not_create_local_binding() {
1402513935
let code = compile_exec(
@@ -14052,16 +13962,6 @@ def f2bad():
1405213962
);
1405313963
}
1405413964

14055-
#[test]
14056-
fn test_constant_true_if_pass_keeps_line_anchor_nop() {
14057-
assert_dis_snapshot!(compile_exec(
14058-
"\
14059-
if 1:
14060-
pass
14061-
"
14062-
));
14063-
}
14064-
1406513965
#[test]
1406613966
fn test_negative_constant_binop_folds_after_unary_folding() {
1406713967
let code = compile_exec(

crates/codegen/src/ir.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9378,8 +9378,7 @@ impl CodeInfo {
93789378
} else {
93799379
OpArg::new(ins.target.0)
93809380
};
9381-
let instr_display = instr.display(display_arg, self);
9382-
eprint!("{instr_display}: {depth} {effect:+} => ");
9381+
eprint!("{display_arg:?}: {depth} {effect:+} => ");
93839382
}
93849383
let new_depth = depth.checked_add_signed(effect).ok_or({
93859384
if effect < 0 {

crates/codegen/src/snapshots/rustpython_codegen__compile__tests__bare_function_annotations_check_attribute_and_subscript_expressions.snap

Lines changed: 0 additions & 67 deletions
This file was deleted.

crates/codegen/src/snapshots/rustpython_codegen__compile__tests__const_bool_not_op.snap

Lines changed: 0 additions & 9 deletions
This file was deleted.

crates/codegen/src/snapshots/rustpython_codegen__compile__tests__constant_true_if_pass_keeps_line_anchor_nop.snap

Lines changed: 0 additions & 10 deletions
This file was deleted.

crates/codegen/src/snapshots/rustpython_codegen__compile__tests__if_ands.snap

Lines changed: 0 additions & 8 deletions
This file was deleted.

crates/codegen/src/snapshots/rustpython_codegen__compile__tests__if_mixed.snap

Lines changed: 0 additions & 8 deletions
This file was deleted.

0 commit comments

Comments
 (0)