Title: Replace `ir::BlockIdx::NULL` with `Option
Open Graph Title: Replace `ir::BlockIdx::NULL` with `Option
X Title: Replace `ir::BlockIdx::NULL` with `Option
Description: Summary We are using a hack for representing a null block index by doing: RustPython/crates/codegen/src/ir.rs Lines 49 to 50 in 9f250a0 impl BlockIdx { pub const NULL: Self = Self::new(u32::MAX); I think it would be better to remove this...
Open Graph Description: Summary We are using a hack for representing a null block index by doing: RustPython/crates/codegen/src/ir.rs Lines 49 to 50 in 9f250a0 impl BlockIdx { pub const NULL: Self = Self::new(u32::MAX); I...
X Description: Summary We are using a hack for representing a null block index by doing: RustPython/crates/codegen/src/ir.rs Lines 49 to 50 in 9f250a0 impl BlockIdx { pub const NULL: Self = Self::new(u32::MAX); I...
Opengraph URL: https://github.com/RustPython/RustPython/issues/7221
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Replace `ir::BlockIdx::NULL` with `Option\u003cir::BlockIdx>`","articleBody":"## Summary\n\nWe are using a hack for representing a null block index by doing: \nhttps://github.com/RustPython/RustPython/blob/9f250a0f6e51a19b6a4c512728ffd3929a33ebec/crates/codegen/src/ir.rs#L49-L50\n\nI think it would be better to remove this hack and using a proper `Option\u003cBlockIdx>` for representing `Some(BlockIdx)` or a `None` it would ensure a proper care for a `None`/`Some` cases instead of using an `if` condition (which is more error prone) like:\n```rust\nif target == BlockIdx::NULL {\n ...\n} else {\n ...\n}\n```","author":{"url":"https://github.com/ShaharNaveh","@type":"Person","name":"ShaharNaveh"},"datePublished":"2026-02-25T09:03:35Z","url":"https://github.com/RustPython/RustPython/issues/7221"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:9b808d7a-cb33-8c35-a694-7898013868cf |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D786:19B6A2:F45A34:1431BB7:6B01D7D6 |
| html-safe-nonce | 7c8c50334db1901b85125c79097e437ce5bd189de092740230c3d8689da417a2 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJENzg2OjE5QjZBMjpGNDVBMzQ6MTQzMUJCNzo2QjAxRDdENiIsInZpc2l0b3JfaWQiOiI1MTU2NTc5NzMzNTYzMTAzMTkwIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 7db33ee346b76b3e460787c3e01d7879b6d80f81df7c50efd243094e9fbeb1d5 |
| hovercard-subject-tag | issue:3988130780 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/RustPython/RustPython/7221/issue_layout |
| twitter:image | https://opengraph.githubassets.com/e34467e5a7bc95559496bfcb056f8beceb7fdc07c2dd47dd6d2144fd01f916c6/RustPython/RustPython/issues/7221 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/e34467e5a7bc95559496bfcb056f8beceb7fdc07c2dd47dd6d2144fd01f916c6/RustPython/RustPython/issues/7221 |
| og:image:alt | Summary We are using a hack for representing a null block index by doing: RustPython/crates/codegen/src/ir.rs Lines 49 to 50 in 9f250a0 impl BlockIdx { pub const NULL: Self = Self::new(u32::MAX); I... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | ShaharNaveh |
| hostname | github.com |
| expected-hostname | github.com |
| None | cc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c |
| turbo-cache-control | no-preview |
| go-import | github.com/RustPython/RustPython git https://github.com/RustPython/RustPython.git |
| octolytics-dimension-user_id | 39710557 |
| octolytics-dimension-user_login | RustPython |
| octolytics-dimension-repository_id | 135201145 |
| octolytics-dimension-repository_nwo | RustPython/RustPython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 135201145 |
| octolytics-dimension-repository_network_root_nwo | RustPython/RustPython |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 8c77c9e8439031ad54c75a250694842892f693e1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width