Migrate from nightly-2022-01-20 to stable#19
Conversation
- Remove #![feature(linkage)] and #![cfg_attr(mips, asm_experimental_arch)] - Drop weak default trap_handler (RISC-V, MIPS), users must provide their own - Disable x86_64 crate's nightly feature, use instructions feature instead - Fix set_handler_fn -> set_handler_addr in IDT init (needs abi_x86_interrupt) - Bump UEFI example deps to uefi 0.38, drop uefi-services - Remove naked/efiapi/core_intrinsics feature gates from UEFI example - Rename .cargo/config to .cargo/config.toml - Add -cpu max to UEFI QEMU invocation for FSGSBASE - Fix function-to-integer casts for Rust 1.96 lint - Update CI workflows to use stable toolchain
|
@mkroening Does this pr fixes your problem? Hopefully it doesn't break other crates. |
There was a problem hiding this comment.
Pull request overview
This PR migrates the project off the pinned nightly-2022-01-20 toolchain toward stable Rust by removing nightly-only feature gates, updating low-level address casts, and modernizing example/CI/tooling configuration.
Changes:
- Remove nightly feature gates (e.g., weak linkage) and switch multiple function-address casts to stable-friendly pointer casts.
- Update x86_64 IDT/syscall setup to avoid relying on nightly-only handler typing.
- Modernize examples and CI to use
dtolnay/rust-toolchain, newer dependencies, and.cargo/config.toml.
Reviewed changes
Copilot reviewed 21 out of 22 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/lib.rs | Drops nightly feature gates at the crate level. |
| src/arch/x86_64/syscall.rs | Updates syscall entry address casting for stable. |
| src/arch/x86_64/idt.rs | Refactors IDT vector installation to use handler addresses (but currently introduces UB via aliasing). |
| src/arch/x86_64/fncall.rs | Updates test helper RIP casting to stable-friendly pointer casts. |
| src/arch/riscv/trap.S | Switches to tail for the trap handler jump. |
| src/arch/riscv/trap.rs | Removes weak trap_handler and updates trap entry address cast. |
| src/arch/mipsel/trap.rs | Removes weak trap_handler stub. |
| src/arch/aarch64/trap.rs | Updates exception vector address cast to stable-friendly pointer casts. |
| src/arch/aarch64/fncall.rs | Updates ELR/X30 address casts in tests. |
| rust-toolchain | Pins default toolchain to stable. |
| examples/uefi/src/main.rs | Removes nightly features; replaces naked fn with global_asm!; updates to newer uefi init style. |
| examples/uefi/Makefile | Tweaks QEMU args (-cpu max). |
| examples/uefi/Cargo.toml | Bumps edition/deps; adds abort panic profiles; updates x86_64/uefi dependency configuration. |
| examples/uefi/.cargo/config.toml | Adds target selection via TOML config. |
| examples/uefi/.cargo/config | Removes deprecated config and unstable build-std settings. |
| examples/riscv/src/main.rs | Updates entry address cast to stable-friendly pointer casts. |
| examples/riscv/Makefile | Adjusts build flow to use cargo +nightly and run QEMU with -kernel. |
| examples/riscv/Cargo.toml | Updates opensbi-rt git revision. |
| examples/riscv/.cargo/config.toml | Adds per-target linker script flags and a default target. |
| Cargo.toml | Pins x86_64 dependency features to avoid default/nightly features. |
| .github/workflows/main.yml | Moves CI to ubuntu-latest and dtolnay/rust-toolchain; adjusts build/test jobs (aarch64 tests no longer run). |
| .github/workflows/deploy.yml | Updates toolchain setup; adjusts doc build loop (currently has a duplicated target). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| let idt = Box::leak(Box::new(InterruptDescriptorTable::new())); | ||
| // let idt = sidt().base; | ||
| let entries: &'static mut [Entry<HandlerFunc>; 256] = | ||
| unsafe { core::mem::transmute_copy(&idt) }; | ||
| let entries: &'static mut [Entry<()>; 256] = unsafe { core::mem::transmute_copy(&idt) }; | ||
| for i in 0..256 { | ||
| let opt = entries[i].set_handler_fn(unsafe { core::mem::transmute(VECTORS[i]) }); | ||
| let opt = unsafe { entries[i].set_handler_addr(VirtAddr::new(VECTORS[i] as usize as u64)) }; |
| test-aarch64: | ||
| runs-on: ubuntu-20.04 | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v2 | ||
| - run: rm rust-toolchain | ||
| - uses: actions-rs/toolchain@v1 | ||
| with: | ||
| profile: minimal | ||
| toolchain: nightly-2022-01-20 | ||
| target: aarch64-unknown-linux-gnu | ||
| override: true | ||
| - uses: actions-rs/cargo@v1 | ||
| - uses: actions/checkout@v4 | ||
| - uses: dtolnay/rust-toolchain@stable | ||
| with: | ||
| use-cross: true | ||
| command: test | ||
| args: --target aarch64-unknown-linux-gnu | ||
| targets: aarch64-unknown-linux-gnu | ||
| - run: cargo build --target aarch64-unknown-linux-gnu |
Since this includes hermit-os/kernel#2525, I believe it does. 👍 |
…t, fix qemu dep, rename test-aarch64
|
@jiegec, could you publish a release with this? :) |
|
Drop nightly dependency: remove feature gates, replace weak linkage with user-provided trap_handler, disable x86_64 crate nightly feature, update deps and CI.