title: What is the point of diverging functions in Rust?
body: <p>I have read several answers on SO already, and gathered these use-cases:</p>
  <ul>
  <li>When a function <code>panic!</code>s</li>
  <li>When a function has an infinite loop in it</li>
  </ul>
  <p>But it is still unclear to me why we need to define the function like this:</p>
  <pre><code>fn func() -&gt; ! {
      panic!(&quot;Error!&quot;);
  }
  </code></pre>
  <p>if it will work the same way as this (without the exclamation sign):</p>
  <pre><code>fn func() {
      panic!(&quot;Error!&quot;);
  }
  </code></pre>
  <p>and at the same time, why do we need to use <code>!</code> in functions with infinite loops? It look like this signature doesn't bring any real usage information.</p>