title: Lifetime issue with a lazy_static mutable variable
body: <p>I use <code>lazy_static</code> to keep a <code>HashMap</code> in the memory. With two methods I am adding and getting elements, but I am having some problems with lifetimes.</p>
  
  <p>This is my code:</p>
  
  <pre><code>#[macro_use]
  extern crate lazy_static;
  
  use std::sync::Mutex;
  use std::collections::HashMap;
  
  lazy_static! {
      static ref HASHMAP: Mutex&lt;HashMap&lt;String, Foo&gt;&gt; = Mutex::new({
          let mut m = HashMap::new();
          m.insert("one".to_string(), Foo{param1:"foo1".to_string(),    param2:"foo2".to_string()} );
          m.insert("two".to_string(), Foo{param1:"bar1".to_string(), param2:"bar2".to_string()});
          m
      });
  }
  
  pub struct Foo{
      param1: String,
      param2: String,
  }
  
  pub fn ins_val(name: String, f: Foo){
      HASHMAP.lock().unwrap().insert(name, f);
  }
  
  pub fn get_val(k: &amp;str) -&gt; Option&lt;&amp;Foo&gt;{
      HASHMAP.lock().unwrap().get(k)
  }
  </code></pre>
  
  <p>And this is the error:</p>
  
  <pre><code>HASHMAP.lock().unwrap().get(k) 
  ^^^^^^^^^^^^^^^^^^^^^^^
  reference must be valid for the anonymous lifetime #1 defined on the block
  </code></pre>