2026-10-26 01:00 UTC
No, I am not talking about the same functionality and without using cargo. I am talking about using rustc to compile individual Rust programs.
$ ls -1
hello.rs
main.rs
main.rs:
mod hello;
fn main() {
hello::print_hello();
}
hello.rs:
pub fn print_hello() {
println!("Hello World!");
}
$ rustc --target helloworld main.rs
$ ./helloworld
Hello World!
No Cargo, no toml, no registry.
Replies (2)
-
@urushitan@kakera.kintsugi.moe 2026-10-26 02:05
At this point I believe you must be trolling. Yes, you don’t need cargo to compile a hello world program, thank you.
-
@Ferk@lemmy.ml 2026-10-26 10:34
Nobody is gonna manually compile each .rs file one by one and link it… for anything else than a 1 file simple project you’d want to use another tool (like make or cargo), to automate that.