【发布时间】:2021-11-05 13:48:29
【问题描述】:
pub const unsafe extern "C" fn CMSG_SPACE(length: c_uint) -> c_uint
但是,如果我编译
fn main() {
let _ = [0u8; libc::CMSG_SPACE(1) as usize];
}
我收到以下错误:
error[E0015]: calls in constants are limited to constant functions, tuple structs and tuple variants
--> src/bin/libc-const.rs:2:27
|
2 | let _ = [0u8; unsafe {libc::CMSG_SPACE(1) as usize}];
| ^^^^^^^^^^^^^^^^^^^
For more information about this error, try `rustc --explain E0015`.
【问题讨论】:
标签: rust libc compile-time-constant