Skip to content

error[E0412]: cannot find type FromBytesUntilNulError in module std::ffi #550

Description

@yurivict
error[E0412]: cannot find type `FromBytesUntilNulError` in module `std::ffi`
   --> src/util.rs:358:66
    |
358 | pub fn i8_to_cstr(x: &[i8]) -> Result<&std::ffi::CStr, std::ffi::FromBytesUntilNulError> {
    |                                                                  ^^^^^^^^^^^^^^^^^^^^^^
   --> /wrkdirs/usr/ports/lang/rust/work/rustc-1.72.0-src/library/core/src/ffi/c_str.rs:116:1
    |
    = note: similarly named struct `FromBytesWithNulError` defined here
    |
help: a struct with a similar name exists
    |
358 | pub fn i8_to_cstr(x: &[i8]) -> Result<&std::ffi::CStr, std::ffi::FromBytesWithNulError> {
    |                                                                  ~~~~~~~~~~~~~~~~~~~~~
help: consider importing this struct
    |
1   + use core::ffi::FromBytesUntilNulError;
    |
help: if you import `FromBytesUntilNulError`, refer to it directly
    |
358 - pub fn i8_to_cstr(x: &[i8]) -> Result<&std::ffi::CStr, std::ffi::FromBytesUntilNulError> {
358 + pub fn i8_to_cstr(x: &[i8]) -> Result<&std::ffi::CStr, FromBytesUntilNulError> {
    |

For more information about this error, try `rustc --explain E0412`.
error: could not compile `procs` (bin "procs") due to previous error

Version: 0.14.3
rust-1.72.0
FreeBSD 13.2

Activity

  1. dalance commented on Oct 25, 2023

    @dalance
    Owner

    std::ffi::FromBytesUntilNulError seems to be missing at Rust 1.72.0.
    rust-lang/rust#113701

    Could you update to Rust 1.73.0?

  2. yurivict commented on Oct 25, 2023

    @yurivict
    Author

    It builds with Rust 1.73.0, thanks!

  3. tgross35 commented on Oct 31, 2023

    @tgross35

    Maybe rust-version in Cargo.toml should be updated?

  4. dalance commented on Nov 1, 2023

    @dalance
    Owner

    If rust-version is updated, all platforms are affected.
    I think this is too much restriction.

    I changed std::ffi::FromBytesUntilNulError to core::ffi::FromBytesUntilNulError.
    By this changing, Rust 1.69.0 can be used.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions