启用const_mut_refs特性时Rust nightly编译器无法找到main函数
添加
#![cfg(feature = "const_mut_refs")]后,Nightly Rust编译提示找不到main函数 问题详情
我在项目代码顶部添加了#![cfg(feature = "const_mut_refs")]特性标注,使用Rust nightly编译器编译时,明明src/main.rs里存在fn main()函数,却收到如下错误:
mainfunction not found in crateinsert_name_hereconsider adding amainfunction tosrc/main.rs
我已经写出了最小可复现代码,推测这是编译器引发的非典型编译错误,想问问社区有没有人遇到过类似问题,或者有解决思路/方案可以分享。
最小复现示例
#![cfg(feature = "const_mut_refs")] fn main() { println!("Hello, world!"); }
编译方式
使用以下命令编译:
cargo +nightly build
内容的提问来源于stack exchange,提问作者Thetrue kingofwaffles
相关产品推荐
相关产品推荐

