rust
rust copied to clipboard
Various fixes for Xous
This patchset includes several fixes for Xous that have crept in over the last few months:
- The
adjust_process()syscall was incorrect - Warnings have started appearing in
alloc-- adopt the same approach as wasm, until wasm figures out a workaround - Dead code warnings have appeared in the networking code. Add
allow(dead_code)as these structs are used as IPC values - Add support for
argsandenv, which have been useful for running tests - Update
unwindingto0.2.3which fixes the recent regression due to changes inasm!()code
r? @jhpratt
rustbot has assigned @jhpratt. They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.
Use r? to explicitly pick a reviewer
These commits modify the library/Cargo.lock file. Unintentional changes to library/Cargo.lock can be introduced when switching branches and rebasing PRs.
If this was unintentional then you should revert the changes before this PR is merged. Otherwise, you can ignore this comment.
The job mingw-check-tidy failed! Check out the build log: (web) (plain)
Click to see the possible cause of the failure (guessed by this bot)
COPY host-x86_64/mingw-check/validate-toolstate.sh /scripts/
COPY host-x86_64/mingw-check/validate-error-codes.sh /scripts/
# NOTE: intentionally uses python2 for x.py so we can test it still works.
# validate-toolstate only runs in our CI, so it's ok for it to only support python3.
ENV SCRIPT TIDY_PRINT_DIFF=1 python2.7 ../x.py test \
--stage 0 src/tools/tidy tidyselftest --extra-checks=py:lint,cpp:fmt
# This file is autogenerated by pip-compile with Python 3.10
# by the following command:
#
# pip-compile --allow-unsafe --generate-hashes reuse-requirements.in
---
#13 2.791 Building wheels for collected packages: reuse
#13 2.792 Building wheel for reuse (pyproject.toml): started
#13 3.038 Building wheel for reuse (pyproject.toml): finished with status 'done'
#13 3.039 Created wheel for reuse: filename=reuse-4.0.3-cp310-cp310-manylinux_2_35_x86_64.whl size=132715 sha256=dfa09868353292d98f811d3efdb0d54d07389e808efc71d68e3b93c514bf8bec
#13 3.039 Stored in directory: /tmp/pip-ephem-wheel-cache-kvahtk8m/wheels/3d/8d/0a/e0fc6aba4494b28a967ab5eaf951c121d9c677958714e34532
#13 3.042 Installing collected packages: boolean-py, binaryornot, tomlkit, reuse, python-debian, markupsafe, license-expression, jinja2, chardet, attrs
#13 3.435 Successfully installed attrs-23.2.0 binaryornot-0.4.4 boolean-py-4.0 chardet-5.2.0 jinja2-3.1.4 license-expression-30.3.0 markupsafe-2.1.5 python-debian-0.1.49 reuse-4.0.3 tomlkit-0.13.0
#13 3.435 WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
#13 3.962 Collecting virtualenv
#13 3.962 Collecting virtualenv
#13 4.013 Downloading virtualenv-20.26.6-py3-none-any.whl (6.0 MB)
#13 4.233 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 6.0/6.0 MB 27.5 MB/s eta 0:00:00
#13 4.278 Collecting distlib<1,>=0.3.7
#13 4.285 Downloading distlib-0.3.9-py2.py3-none-any.whl (468 kB)
#13 4.297 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 469.0/469.0 KB 47.0 MB/s eta 0:00:00
#13 4.335 Collecting platformdirs<5,>=3.9.1
#13 4.342 Downloading platformdirs-4.3.6-py3-none-any.whl (18 kB)
#13 4.384 Collecting filelock<4,>=3.12.2
#13 4.390 Downloading filelock-3.16.1-py3-none-any.whl (16 kB)
#13 4.471 Installing collected packages: distlib, platformdirs, filelock, virtualenv
#13 4.659 Successfully installed distlib-0.3.9 filelock-3.16.1 platformdirs-4.3.6 virtualenv-20.26.6
#13 DONE 4.7s
#14 [7/8] COPY host-x86_64/mingw-check/validate-toolstate.sh /scripts/
#14 DONE 0.0s
---
DirectMap4k: 204736 kB
DirectMap2M: 11329536 kB
DirectMap1G: 7340032 kB
##[endgroup]
Executing TIDY_PRINT_DIFF=1 python2.7 ../x.py test --stage 0 src/tools/tidy tidyselftest --extra-checks=py:lint,cpp:fmt
+ TIDY_PRINT_DIFF=1 python2.7 ../x.py test --stage 0 src/tools/tidy tidyselftest --extra-checks=py:lint,cpp:fmt
Finished `dev` profile [unoptimized] target(s) in 0.04s
##[endgroup]
downloading https://static.rust-lang.org/dist/2024-09-22/rustfmt-nightly-x86_64-unknown-linux-gnu.tar.xz
extracting /checkout/obj/build/cache/2024-09-22/rustfmt-nightly-x86_64-unknown-linux-gnu.tar.xz to /checkout/obj/build/x86_64-unknown-linux-gnu/rustfmt
---
Compiling tidy v0.1.0 (/checkout/src/tools/tidy)
Finished `release` profile [optimized] target(s) in 30.37s
##[endgroup]
fmt check
Diff in /checkout/library/std/src/sys/pal/xous/os.rs:5:
use crate::marker::PhantomData;
use crate::os::xous::ffi::Error as XousError;
-use crate::sync::{
- atomic::{AtomicPtr, AtomicUsize, Ordering},
- Mutex, Once,
-};
-};
+use crate::sync::atomic::{AtomicPtr, AtomicUsize, Ordering};
+use crate::sync::{Mutex, Once};
use crate::{fmt, io, vec};
pub(crate) mod params;
pub(crate) mod params;
Diff in /checkout/library/std/src/sys/pal/xous/os/params/test.rs:1:
-use crate::{collections::HashMap, io::Write};
+use crate::collections::HashMap;
+use crate::io::Write;
fn create_args_test() -> std::io::Result<Vec<u8>> {
let mut sample_data = vec![];
fmt error: Running `"/checkout/obj/build/x86_64-unknown-linux-gnu/rustfmt/bin/rustfmt" "--config-path" "/checkout" "--edition" "2021" "--unstable-features" "--skip-children" "--check" "/checkout/library/std/src/sys/personality/dwarf/mod.rs" "/checkout/library/std/src/sys/personality/mod.rs" "/checkout/library/std/src/sys/backtrace.rs" "/checkout/library/std/src/sys/alloc/windows.rs" "/checkout/library/std/src/sys/alloc/zkvm.rs" "/checkout/library/std/src/sys/alloc/windows/tests.rs" "/checkout/library/std/src/sys/alloc/hermit.rs" "/checkout/library/std/src/sys/alloc/unix.rs" "/checkout/library/std/src/sys/alloc/solid.rs" "/checkout/library/std/src/sys/alloc/xous.rs" "/checkout/library/std/src/sys/alloc/wasm.rs" "/checkout/library/std/src/sys/alloc/sgx.rs" "/checkout/library/std/src/sys/alloc/uefi.rs" "/checkout/library/std/src/sys/alloc/mod.rs" "/checkout/library/std/src/sys/path/unsupported_backslash.rs" "/checkout/library/std/src/sys/path/windows.rs" "/checkout/library/std/src/sys/path/windows/tests.rs" "/checkout/library/std/src/sys/path/unix.rs" "/checkout/library/std/src/sys/path/sgx.rs" "/checkout/library/std/src/sys/path/mod.rs" "/checkout/library/std/src/sys/exit_guard.rs" "/checkout/library/std/src/sys/thread_local/destructors/list.rs" "/checkout/library/std/src/sys/thread_local/destructors/linux_like.rs" "/checkout/library/std/src/sys/thread_local/os.rs" "/checkout/library/std/src/sys/thread_local/guard/key.rs" "/checkout/library/std/src/sys/thread_local/guard/apple.rs" "/checkout/library/std/src/sys/thread_local/guard/windows.rs" "/checkout/library/std/src/sys/thread_local/guard/solid.rs" "/checkout/library/std/src/sys/thread_local/native/lazy.rs" "/checkout/library/std/src/sys/thread_local/native/eager.rs" "/checkout/library/std/src/sys/thread_local/native/mod.rs" "/checkout/library/std/src/sys/thread_local/key/racy.rs" "/checkout/library/std/src/sys/thread_local/key/windows.rs" "/checkout/library/std/src/sys/thread_local/key/unix.rs" "/checkout/library/std/src/sys/thread_local/key/tests.rs" "/checkout/library/std/src/sys/thread_local/key/xous.rs" "/checkout/library/std/src/sys/thread_local/key/sgx.rs" "/checkout/library/std/src/sys/thread_local/statik.rs" "/checkout/library/std/src/sys/thread_local/mod.rs" "/checkout/library/std/src/sys/random/espidf.rs" "/checkout/library/std/src/sys/random/apple.rs" "/checkout/library/std/src/sys/random/windows.rs" "/checkout/library/std/src/sys/random/zkvm.rs" "/checkout/library/std/src/sys/random/teeos.rs" "/checkout/library/std/src/sys/random/wasi.rs" "/checkout/library/std/src/sys/random/horizon.rs" "/checkout/library/std/src/sys/random/hermit.rs" "/checkout/library/std/src/sys/random/linux.rs" "/checkout/library/std/src/sys/random/vxworks.rs" "/checkout/library/std/src/sys/random/unsupported.rs" "/checkout/library/std/src/sys/random/unix_legacy.rs" "/checkout/library/std/src/sys/random/solid.rs" "/checkout/library/std/src/sys/random/fuchsia.rs" "/checkout/library/std/src/sys/random/getentropy.rs" "/checkout/library/std/src/sys/random/sgx.rs" "/checkout/library/std/src/sys/random/uefi.rs" "/checkout/library/std/src/sys/random/arc4random.rs" "/checkout/library/std/src/sys/random/mod.rs" "/checkout/library/std/src/sys/random/redox.rs" "/checkout/library/std/src/sys/cmath.rs" "/checkout/library/std/src/sys/mod.rs" "/checkout/library/std/src/sys/pal/xous/os.rs" "/checkout/library/std/src/sys/pal/xous/os/params/test.rs" "/checkout/compiler/rustc_trait_selection/src/traits/misc.rs"` failed.
If you're running `tidy`, try again with `--bless`. Or, if you just want to format code, run `./x.py fmt` instead.
local time: Sun Oct 13 14:05:35 UTC 2024
local time: Sun Oct 13 14:05:35 UTC 2024
network time: Diff in /checkout/library/std/src/sys/pal/xous/args.rs:1:
use crate::ffi::OsString;
-use crate::sys::pal::xous::os::{get_application_parameters, params::ArgumentList};
+use crate::sys::pal::xous::os::get_application_parameters;
+use crate::sys::pal::xous::os::params::ArgumentList;
use crate::{fmt, vec};
pub struct Args {
Sun, 13 Oct 2024 14:05:35 GMT
##[error]Process completed with exit code 1.
Post job cleanup.
The job mingw-check-tidy failed! Check out the build log: (web) (plain)
Click to see the possible cause of the failure (guessed by this bot)
COPY host-x86_64/mingw-check/validate-toolstate.sh /scripts/
COPY host-x86_64/mingw-check/validate-error-codes.sh /scripts/
# NOTE: intentionally uses python2 for x.py so we can test it still works.
# validate-toolstate only runs in our CI, so it's ok for it to only support python3.
ENV SCRIPT TIDY_PRINT_DIFF=1 python2.7 ../x.py test \
--stage 0 src/tools/tidy tidyselftest --extra-checks=py:lint,cpp:fmt
# This file is autogenerated by pip-compile with Python 3.10
# by the following command:
#
# pip-compile --allow-unsafe --generate-hashes reuse-requirements.in
---
#13 2.708 Building wheels for collected packages: reuse
#13 2.709 Building wheel for reuse (pyproject.toml): started
#13 2.964 Building wheel for reuse (pyproject.toml): finished with status 'done'
#13 2.965 Created wheel for reuse: filename=reuse-4.0.3-cp310-cp310-manylinux_2_35_x86_64.whl size=132715 sha256=dfa09868353292d98f811d3efdb0d54d07389e808efc71d68e3b93c514bf8bec
#13 2.966 Stored in directory: /tmp/pip-ephem-wheel-cache-ewsco7qe/wheels/3d/8d/0a/e0fc6aba4494b28a967ab5eaf951c121d9c677958714e34532
#13 2.968 Installing collected packages: boolean-py, binaryornot, tomlkit, reuse, python-debian, markupsafe, license-expression, jinja2, chardet, attrs
#13 3.369 Successfully installed attrs-23.2.0 binaryornot-0.4.4 boolean-py-4.0 chardet-5.2.0 jinja2-3.1.4 license-expression-30.3.0 markupsafe-2.1.5 python-debian-0.1.49 reuse-4.0.3 tomlkit-0.13.0
#13 3.369 WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
#13 3.898 Collecting virtualenv
#13 3.898 Collecting virtualenv
#13 3.935 Downloading virtualenv-20.26.6-py3-none-any.whl (6.0 MB)
#13 4.014 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 6.0/6.0 MB 78.7 MB/s eta 0:00:00
#13 4.070 Collecting platformdirs<5,>=3.9.1
#13 4.074 Downloading platformdirs-4.3.6-py3-none-any.whl (18 kB)
#13 4.094 Collecting distlib<1,>=0.3.7
#13 4.104 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 469.0/469.0 KB 82.7 MB/s eta 0:00:00
#13 4.138 Collecting filelock<4,>=3.12.2
#13 4.141 Downloading filelock-3.16.1-py3-none-any.whl (16 kB)
#13 4.141 Downloading filelock-3.16.1-py3-none-any.whl (16 kB)
#13 4.223 Installing collected packages: distlib, platformdirs, filelock, virtualenv
#13 4.412 Successfully installed distlib-0.3.9 filelock-3.16.1 platformdirs-4.3.6 virtualenv-20.26.6
#13 DONE 4.5s
#14 [7/8] COPY host-x86_64/mingw-check/validate-toolstate.sh /scripts/
#14 DONE 0.0s
---
DirectMap4k: 200640 kB
DirectMap2M: 8187904 kB
DirectMap1G: 10485760 kB
##[endgroup]
Executing TIDY_PRINT_DIFF=1 python2.7 ../x.py test --stage 0 src/tools/tidy tidyselftest --extra-checks=py:lint,cpp:fmt
+ TIDY_PRINT_DIFF=1 python2.7 ../x.py test --stage 0 src/tools/tidy tidyselftest --extra-checks=py:lint,cpp:fmt
Finished `dev` profile [unoptimized] target(s) in 0.04s
##[endgroup]
downloading https://static.rust-lang.org/dist/2024-09-22/rustfmt-nightly-x86_64-unknown-linux-gnu.tar.xz
extracting /checkout/obj/build/cache/2024-09-22/rustfmt-nightly-x86_64-unknown-linux-gnu.tar.xz to /checkout/obj/build/x86_64-unknown-linux-gnu/rustfmt
---
fmt check
fmt: checked 5603 files
tidy check
tidy: Skipping binary file check, read-only filesystem
tidy error: `/checkout/library/std/src/sys/pal/xous/os/params/test.rs:55` contains `#[test]`; unit tests and benchmarks must be placed into separate files or directories named `tests.rs`, `benches.rs`, `tests` or `benches`
removing old virtual environment
creating virtual environment at '/checkout/obj/build/venv' using 'python3.10'
Requirement already satisfied: pip in ./build/venv/lib/python3.10/site-packages (24.2)
All checks passed!
checking C++ file formatting
some tidy checks failed
some tidy checks failed
Command has failed. Rerun with -v to see more details.
local time: Sun Oct 13 14:14:45 UTC 2024
network time: Sun, 13 Oct 2024 14:14:45 GMT
##[error]Process completed with exit code 1.
Post job cleanup.
I'm not going to pretend to have ever heard of this OS before now, so I don't have the knowledge to review this. A quick search shows that there's no ping group that manages this OS, so unfortunately I've got to roll the dice on who gets assigned :/
r? libs
This code is entirely within cfgs for xous, which is tier 3, so we usually just let the target maintainers for such targets do what they need so long as the code is broadly fine. The code seems broadly fine to me, so ship it.
@bors r+ rollup
:pushpin: Commit 99de67af35b90b3e1a90849ec8bc6e92e0b73370 has been approved by thomcc
It is now in the queue for this repository.
@thomcc Where would I check who the target maintainers are? For future reference, of course.
As far as I know, I'm the target maintainer, at least according to https://doc.rust-lang.org/nightly/rustc/platform-support/riscv32imac-unknown-xous-elf.html
Thanks! I wasn't doubting you specifically, moreso asking as I've never reviewed a PR like this in the past. That's definitely the section I was looking for.
Ah, thank you for the reivew! The list is at https://doc.rust-lang.org/nightly/rustc/platform-support.html and most links are clickable.