title: Cannot find type `F` in this scope
body: <p>This might seem obvious, but I want to learn something from it. I am doing some exercises, reimplementing the 'multi-thread http server' of <a href="https://doc.rust-lang.org/stable/book/ch20-00-final-project-a-web-server.html" rel="nofollow noreferrer">the book, chapter 20</a>. It's not completely the same (like I didn't use a <code>Box</code> to hold the task closure), but that's not important.</p>
  <pre class="lang-rust prettyprint-override"><code>use std::{thread};
  use std::sync::{mpsc, Arc, Mutex};
  
  pub struct Executor {
      threads: Vec&lt;thread::JoinHandle&lt;()&gt;&gt;,
      sender: mpsc::Sender&lt;FnOnce() + Send + 'static&gt;,
  }
  
  impl Executor {
      pub fn new(thread_num: usize) -&gt; Executor {
          let (tx, rx) = mpsc::channel();
          let rx = Arc::new(Mutex::new(rx));
          let mut threads = Vec::with_capacity(thread_num);
  
          for i in 0..thread_num {
              let handle = thread::spawn(|| {
                  loop {
                      let rx = rx.lock();
                      let f = rx.recv().unwrap();
                      f();
                  }
              });
              threads.push(handle);
          }
          Executor { threads, sender: tx }
      }
  
  
      pub fn run(&amp;mut self, f: F)
          where
              F: FnOnce() + Send + 'static, {      //*** the compile complains here***
          // let bf = Box::new(f);
          self.sender.send(f);
      }
  }
  </code></pre>
  <p>However, the compiler says:</p>
  <pre class="lang-none prettyprint-override"><code>error[E0412]: cannot find type `F` in this scope
    --&gt; src\lib.rs:31:13
     |
  31 |             F: FnOnce() + Send + 'static, {
     |             ^ help: a trait with a similar name exists: `Fn`
     | 
    ::: C:\Users\ynx\.rustup\toolchains\stable-x86_64-pc-windows-gnu\lib/rustlib/src/rust\library\core\src\ops\function.rs:67:1
     |
  67 | pub trait Fn&lt;Args&gt;: FnMut&lt;Args&gt; {
     | ------------------------------- similarly named trait `Fn` defined here
  </code></pre>
  <p>Where am I wrong?</p>