Question: Why can't two `&'static str`s be concatenated at compile time?

74 points Darcc_Man

Foreword: I know that concat!() exists; I am talking about arbitrary &'static str variables, not just string literal tokens.

I suppose, in other words, why isn't this trait implementation found in the standard library or the core language?:

impl std::ops::Add<&'static str> for &'static str {
    type Output = &'static str;
    fn add() -> Self::Output { /* compiler built-in */ }
}

Surely the compiler could simply allocate a new str in static read-only memory?
If it is unimplemented to de-incentivize polluting static memory with redundant strings, then I understand.

Thanks!