Skip to content

Migrate from nightly-2022-01-20 to stable#19

Merged
jiegec merged 11 commits into
masterfrom
stable-rust
Jul 4, 2026
Merged

Migrate from nightly-2022-01-20 to stable#19
jiegec merged 11 commits into
masterfrom
stable-rust

Conversation

@jiegec

@jiegec jiegec commented Jul 4, 2026

Copy link
Copy Markdown
Member

Drop nightly dependency: remove feature gates, replace weak linkage with user-provided trap_handler, disable x86_64 crate nightly feature, update deps and CI.

jiegec added 4 commits July 4, 2026 08:12
- 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
@jiegec jiegec requested a review from equation314 July 4, 2026 00:34
@jiegec

jiegec commented Jul 4, 2026

Copy link
Copy Markdown
Member Author

@mkroening Does this pr fixes your problem? Hopefully it doesn't break other crates.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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.

Comment thread src/arch/x86_64/idt.rs Outdated
Comment on lines +13 to +16
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)) };
Comment thread .github/workflows/main.yml Outdated
Comment on lines +57 to +64
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
Comment thread .github/workflows/deploy.yml
Comment thread examples/riscv/Makefile
@mkroening

Copy link
Copy Markdown
Contributor

@mkroening Does this pr fixes your problem? Hopefully it doesn't break other crates.

Since this includes hermit-os/kernel#2525, I believe it does. 👍

@jiegec jiegec merged commit e1946c9 into master Jul 4, 2026
22 checks passed
@jiegec jiegec deleted the stable-rust branch July 4, 2026 13:03
@mkroening

Copy link
Copy Markdown
Contributor

@jiegec, could you publish a release with this? :)

@jiegec

jiegec commented Jul 6, 2026

Copy link
Copy Markdown
Member Author

@jiegec, could you publish a release with this? :)

@wangrunji0408 @equation314

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.

3 participants