Skip to content

rustix::io::Errno impl core::error::Error only with nightly #1527

@dmitry-salin

Description

@dmitry-salin

Support for error_in_core in no_std context was added in #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<E: Error>(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<E: Error>(err: E) {}
   |               ^^^^^ required by this bound in `use_err`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions