What is the difference between crossinline and noinline in Kotlin? : <ol>
<li><p>This code <strong>compiles with a warning</strong> (<em>insignificant performance impact</em>):</p>

<pre><code>inline fun test(noinline f: () -&gt; Unit) {
    thread(block = f)
}
</code></pre></li>
<li><p>This code <strong>does not compile</strong> (<em>illegal usage of inline-parameter</em>):</p>

<pre><code>inline fun test(crossinline f: () -&gt; Unit) {
    thread(block = f)
}
</code></pre></li>
<li><p>This code <strong>compiles with a warning</strong> (<em>insignificant performance impact</em>):</p>

<pre><code>inline fun test(noinline f: () -&gt; Unit) {
    thread { f() }
}
</code></pre></li>
<li><p>This code <strong>compiles with no warning or error</strong>:</p>

<pre><code>inline fun test(crossinline f: () -&gt; Unit) {
    thread { f() }
}
</code></pre></li>
</ol>

<p>Here are my questions:</p>

<ul>
<li>How come (2) does not compile but (4) does?</li>
<li>What exactly is the difference between <code>noinline</code> and <code>crossinline</code>?</li>
<li>If (3) does not generates a no performance improvements, why would (4) do?</li>
</ul>
