title: How can I create a static String in Rust?
body: <p>Is there a way I can create a static String in Rust?</p>
  
  <p>I tried this:</p>
  
  <pre class="lang-rust prettyprint-override"><code>static somestring: String = String::new();
  </code></pre>
  
  <p>but I got this error: </p>
  
  <pre class="lang-rust prettyprint-override"><code>error: `std::string::String::new` is not yet stable as a const fn
   --&gt; src/main.rs:2:29
    |
  2 | static somestring: String = String::new();
    |
  </code></pre>
  
  <p><a href="https://stackoverflow.com/questions/32956050/how-to-create-a-static-string-at-compile-time?noredirect=1&amp;lq=1">How to create a static string at compile time</a> does not solve my problem because it's about <code>&amp;'static str</code>, not <code>String</code>. I need the <code>String</code> to be globally addressable.</p>