Yes it would happen the signal is handled by rust, I can reproduce your example.
fn main() {
use std::io::{stdin,stdout,Write};
let mut s=String::new();
let _=stdout().flush();
stdin().read_line(&mut s).expect("Did not enter a correct string");
}
then kill -SEGV <pid>
first does not affect this program, and after a second invocation does result in a sigsegv.
I couldn't find an explicit reason for this, although this seems related to the handling of stack overflow. Here are some links discussing the existence of the handler:
-
https://github.com/rust-lang/rust/issues/31273 : "Considering Rust already traps the SIGSEGV, modifying the signal handler to exit at that point should be easy."
-
Rust guarantees no segfaults with only safe code but it segfaults (stack overflow) : " I would say that a
SIGSEGV
signal used as an implementation detail for performance reasons need not be called a “segfault” in introductory material."