no1wudi opened a new pull request, #3421:
URL: https://github.com/apache/nuttx-apps/pull/3421

   ## Summary
   
   Fix the `panic_immediate_abort` compile error in Rust build system by 
replacing the deprecated `-Zbuild-std-features=panic_immediate_abort` flag with 
the new `-Cpanic=immediate-abort` compiler flag.
   
   Recent Rust nightly versions have stabilized `panic_immediate_abort` as a 
real panic strategy. The old method of enabling it via 
`-Zbuild-std-features=panic_immediate_abort` is no longer supported and 
triggers a compile error in `core/src/panicking.rs`:
   
   ```
   error: panic_immediate_abort is now a real panic strategy!
   Enable it with `panic = "immediate-abort"` in Cargo.toml,
   or with the compiler flags `-Zunstable-options -Cpanic=immediate-abort`.
   ```
   
   This change updates both CMake and Makefile build systems to use the new 
approach via `RUSTFLAGS` environment variable.
   
   ## Impact
   
   - Impact on user: NO - No user-facing changes, only fixes build with newer 
Rust toolchains
   - Impact on build: YES - Fixes Rust build with recent nightly compilers
   - Impact on hardware: NO
   - Impact on documentation: NO
   - Impact on security: NO
   - Impact on compatibility: YES - Maintains compatibility with both old and 
new Rust versions by using the officially supported flag
   
   ## Testing
   
   Build Host: Ubuntu 22.04, x86_64, Rust nightly 2025-03-01
   Target: ARM stm32f746g-disco:nsh
   
   Verified the fix by:
   1. Enabling Rust hello example with cargo 
(`CONFIG_EXAMPLES_HELLO_RUST_CARGO=y`)
   2. Enabling release mode (`CONFIG_DEBUG_FULLOPT=y`)
   3. Enabling TLS support (`CONFIG_TLS_NELEM=4`) required for Rust std library
   4. Building successfully without the `panic_immediate_abort` error
   
   Build output:
   ```
   [1123/1127] Building Rust crate hello
      Compiling hello v0.1.0
       Finished `release` profile [optimized] target(s) in 11.34s
   [1124/1127] Linking CXX executable nuttx
   Memory region         Used Size  Region Size  %age Used
              flash:      126020 B         1 MB     12.02%
              sram1:        5896 B       240 KB      2.40%
   [1127/1127] Generating System.map
   ```
   
   The firmware builds successfully and links the Rust static library without 
errors.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to