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

Compiler error on rustix. #1224

Closed
limuyao1996 opened this issue Nov 26, 2024 · 3 comments
Closed

Compiler error on rustix. #1224

limuyao1996 opened this issue Nov 26, 2024 · 3 comments

Comments

@limuyao1996
Copy link

limuyao1996 commented Nov 26, 2024

I use some packages that depend on rustix. Then I got a compiler error on [email protected]. Is this a code error in rustix?

My env:
rustc 1.82.0 (f6e511eec 2024-10-15)
cargo 1.82.0 (8f40fc59f 2024-08-21)
Macbook pro M1 pro

Compiling rustix v0.38.41
error[E0015]: cannot call non-const fn `libc::CMSG_SPACE` in constant functions
   --> /Users/limuyao/.cargo/registry/src/rsproxy.cn-0dccff568467c15b/rustix-0.38.41/src/net/send_recv/msg.rs:120:14
    |
120 |     unsafe { c::CMSG_SPACE(converted_len) as usize }
    |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants

For more information about this error, try `rustc --explain E0015`.
error: could not compile `rustix` (lib) due to 1 previous error
@sunfishcode
Copy link
Member

I don't know; I'm not able to reproduce this. Are you cross-compiling here, and if so, to what target? What version of the libc crate is in use here?

@limuyao1996
Copy link
Author

limuyao1996 commented Nov 27, 2024

I don't know; I'm not able to reproduce this. Are you cross-compiling here, and if so, to what target? What version of the libc crate is in use here?

@sunfishcode Thank you for your reply.
Thanks to your reminder, I checked the issues in the libc repository and found that this seems to be an issue with libc.
This's the link to the related issue: rust-lang/libc#4115

@sunfishcode
Copy link
Member

Thanks for posting the link to that libc issue. I'll close this issue, as this isn't a rustix issue.

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

2 participants