Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
yurivict opened this issue Oct 24, 2023 · 4 comments
Closed

Comments

@yurivict
Copy link

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

@dalance
Copy link
Owner

dalance commented Oct 25, 2023

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

Could you update to Rust 1.73.0?

@yurivict
Copy link
Author

It builds with Rust 1.73.0, thanks!

@tgross35
Copy link

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

@dalance
Copy link
Owner

dalance commented Nov 1, 2023

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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants