在板条箱“rust_out”中找不到“main”函数:考虑在 vim/ale 的板条箱级别添加一个“main”函数

gec*_*kos 7 vim rust

我有一些 Rust 代码,只是有另一个 modu

// main.rs
mod foo;
fn main() {
    foo::hello();
}

// foo.rs
pub fn hello() {
    println!("Hello, world!");
}
Run Code Online (Sandbox Code Playgroud)

但 vim ale https://github.com/dense-analysis/ale不断声称:

`main` function not found in crate `rust_out`: consider adding a `main` function at the crate level
Run Code Online (Sandbox Code Playgroud)

这是配置

...
Plug 'rust-lang/rust.vim'
...
let g:ale_linters = {
      \   'rust': ['rls', 'rustc', 'cargo'],
      \ }
...
Run Code Online (Sandbox Code Playgroud)

cargo build运行正常,啤酒出了问题!?