rust-lang / rust-lang/rust

compilation failure with "cargo check --tests" for espidf

Open
#125,714 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

C-bug O-ESP-IDF T-libs
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

Running cargo check --tests fails to compile test for the esp-idf-template (tested on mcu esp32-c3, default template options).

   Compiling test v0.0.0 (/home/ben/.local/share/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/test)
error[E0308]: mismatched types
   --> /home/ben/.local/share/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/test/src/test_result.rs:102:18
    |
101 |         None => match status.signal() {
    |                       --------------- this expression has type `Option<i32>`
102 |             Some(libc::SIGABRT) => TestResult::TrFailed,
    |                  ^^^^^^^^^^^^^ expected `i32`, found `usize`

For more information about this error, try `rustc --explain E0308`.
error: could not compile `test` (lib) due to 1 previous error

https://github.com/rust-lang/libc/pull/3658 introduced these constants for espidf, where previously the error was a missing constant altogether (https://github.com/rust-lang/rust-analyzer/issues/16552).

Steps to Reproduce
  • cargo generate esp-rs/esp-idf-template cargo
    • Which MCU to target?: esp32c3
    • Configure advanced template options?: false
  • cd <project name> && cargo check --tests
Meta

rustc --version --verbose:

rustc 1.80.0-nightly (da159eb33 2024-05-28)
binary: rustc
commit-hash: da159eb331b27df528185c616b394bb0e1d2a4bd
commit-date: 2024-05-28
host: x86_64-unknown-linux-gnu
release: 1.80.0-nightly
LLVM version: 18.1.6

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with library/test/src/test_result.rs at the reported match on status.signal(), then compare the ESP-IDF libc constants introduced in libc pull request 3658. Reproduce with the esp-rs/esp-idf-template default esp32c3 project and cargo check --tests; done means the test crate compiles without the reported type mismatch.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers, embedded-iot, testing
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.