bytecodealliance / bytecodealliance/rustix

`rustix::io::Errno` impl `core::error::Error` only with nightly

Open
#1,527 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
Rust
Stars
2.1k
Forks
294
Avg merge
4h 7m
Merged PRs (30d)
2

Description

Support for [error_in_core](https://github.com/rust-lang/rust/issues/103765) in no_std context was added in https://github.com/bytecodealliance/rustix/pull/1241 But it seems the `use_feature_or_nothing("error_in_core");` check in `build.rs` requires nightly even with rust 1.81+.

```
❯ rustc --version
rustc 1.85.0 (4d91de4e4 2025-02-17)
```
Cargo.toml
```
[package]
name = "error"
version = "0.1.0"
edition = "2024"

[dependencies]
rustix = { version = "1.1.2", default-features = false }
```

main.rs
```
#![no_std]

use rustix::io::Errno;

use core::error::Error;

fn use_err(err: E) {}

fn main() {
use_err(Errno::ACCESS);
}
```

cargo build
```
error[E0277]: the trait bound `Errno: core::error::Error` is not satisfied
--> src/main.rs:10:13
|
10 | use_err(Errno::ACCESS);
| ------- ^^^^^^^^^^^^^ the trait `core::error::Error` is not implemented for `Errno`
| |
| required by a bound introduced by this call
|
note: required by a bound in `use_err`
--> src/main.rs:7:15
|
7 | fn use_err(err: E) {}
| ^^^^^ required by this bound in `use_err`
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.