-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Switch to Cell::update, slice::{split_first_chunk,split_off}, where appropriate #6974
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2506,15 +2506,11 @@ mod _io { | |
| return None; | ||
| } | ||
| buf.resize(Self::BYTE_LEN, 0); | ||
| let buf: &[u8; Self::BYTE_LEN] = buf.as_slice().try_into().unwrap(); | ||
| let buf: &[u8; Self::BYTE_LEN] = buf.as_array()?; | ||
| macro_rules! get_field { | ||
| ($t:ty, $off:ident) => {{ | ||
| <$t>::from_ne_bytes( | ||
| buf[Self::$off..][..core::mem::size_of::<$t>()] | ||
| .try_into() | ||
| .unwrap(), | ||
| ) | ||
| }}; | ||
| ($t:ty, $off:ident) => { | ||
| <$t>::from_ne_bytes(*buf[Self::$off..].first_chunk().unwrap()) | ||
| }; | ||
|
Comment on lines
+2509
to
+2513
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: find . -name "Cargo.toml" -type f | head -20Repository: RustPython/RustPython Length of output: 639 🏁 Script executed: cat Cargo.toml | grep -A 5 -B 5 "rust-version\|package.version"Repository: RustPython/RustPython Length of output: 700 🏁 Script executed: find . -name "rust-toolchain*" -type fRepository: RustPython/RustPython Length of output: 86 🏁 Script executed: rg -n "rust-version" --type tomlRepository: RustPython/RustPython Length of output: 1141 🏁 Script executed: cat rust-toolchain.tomlRepository: RustPython/RustPython Length of output: 95 🏁 Script executed: rg -n "as_array|first_chunk" crates/vm/src/stdlib/io.rs -B 3 -A 3Repository: RustPython/RustPython Length of output: 480 🏁 Script executed: cd crates/vm && cargo clippy --lib 2>&1 | head -100Repository: RustPython/RustPython Length of output: 204 🏁 Script executed: cd crates/vm && cargo fmt -- --check 2>&1 | grep -A 5 "io.rs"Repository: RustPython/RustPython Length of output: 47 🌐 Web query:
💡 Result:
Sources: [1] [2] MSRV and API compatibility confirmed; ensure linting and formatting checks are clean. The repository's MSRV (1.93.0) supports both slice APIs: Per coding guidelines, run 🤖 Prompt for AI Agents |
||
| } | ||
| Some(Self { | ||
| start_pos: get_field!(Offset, START_POS_OFF), | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unqualified
size_ofwill cause a compilation error.size_ofis not imported and needs to be fully qualified. The rest of the file usescore::mem::size_ofconsistently (e.g., lines 138, 145, 157, 502).🐛 Proposed fix
📝 Committable suggestion
🤖 Prompt for AI Agents