Will the compiler deduplicate large hardcoded values?

50 points tDegan

For example, say I have two large, identical str values. Will the compiler see that they are identical and point all references to the same value?

println!("A long str.");
println!("A long str.");

Will the two instances of "A long str." be the same memory in the binary?

I know Java for example does that.

Does it matter if they are in the same function, module, crate?