How can I hide project info (like source code paths) from panic messages occurred while running a release build?
Assume following code as a Minima Reproducible Example
fn main() {
println!("Hello!");
let v = vec![0];
println!("{:?}", v[1]); // panic - index out of bounds
}
> cargo build --release
> target/release/hello-rust
Getting:
Hello!
thread 'main' panicked at 'index out of bounds: the len is 1 but the index is 1', src/main.rs:5:22
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Revealing "src/main.rs:5:22" is very unwanted. I would prefer not to reveal even that the executable build with Rust.
I would like just to exit the process with "1" error code on every panic
situation, like index out of bounds or .unwrap()
on error.
Tried:
[profile.release]
panic = "abort"
Didn't help.
Tried to look in Profile Settings, didn't find something useful.