Skip to content

Macro for defining opcode & instruction enums#7573

Draft
ShaharNaveh wants to merge 3 commits intoRustPython:mainfrom
ShaharNaveh:bytecode-instr-super-macro
Draft

Macro for defining opcode & instruction enums#7573
ShaharNaveh wants to merge 3 commits intoRustPython:mainfrom
ShaharNaveh:bytecode-instr-super-macro

Conversation

@ShaharNaveh
Copy link
Copy Markdown
Contributor

This macro will generate an Instruction and a Opcode enum, all within rust, no external python scripts with custom config in toml or something.

I'd love to hear what you guys think:)

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 9, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

Run ID: 005ecdfa-f64f-47f6-aa79-3d44ee25c399

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

}

#[derive(Clone, Copy, Debug)]
#[repr($typ)]
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wanted to remove this #[repr(...)], but when doing so I get the following error:

thread 'main' (3429) panicked at crates/vm/src/frame.rs:3790:33:  index out of bounds: the len is 5 but the index is 22
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Instruction::LoadAttrMethodWithValues => {
let oparg = LoadAttr::from_u32(u32::from(arg));
let cache_base = self.lasti() as usize;
let attr_name = self.code.names[oparg.name_idx() as usize];

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant