I was trying something random which would never happen in real world code:
// foo.rs
#[path = "foo"]
mod foo;
This causes an error from rustc but it causes a stack overflow from rust analyzer:
thread '<unknown>' has overflowed its stack
[Error - 12:58:49 PM] Request textDocument/semanticTokens/full/delta failed.