title: What is a function prototype in Rust?
body: <p>I wanted to understand the behaviour of the <code>#[inline]</code> attribute in Rust, so I was reading through <a href="https://doc.rust-lang.org/reference/attributes.html" rel="noreferrer">the Attributes section of The Rust Reference</a>. It was very helpful, but I found this part of the description confusing (emphasis mine):</p>
  <blockquote>
  <p>The <em><code>inline</code></em> attribute suggests to the compiler that it should place a copy of the attributed function in the caller, rather than generating code to call the function where it is defined.</p>
  <p><strong>This attribute can be used on functions and function prototypes, although it does not do anything on function prototypes.</strong></p>
  </blockquote>
  <p>This caveat is repeated for the <code>#[cold]</code> attribute.</p>
  <p>I've never heard the term &quot;function prototype&quot; used with respect to Rust. I know that such a concept exists in JavaScript, but JavaScript's and Rust's object and type systems are very different! What does it mean here?</p>
  <p>Searching further, I found two mentions of function prototypes in <a href="https://doc.rust-lang.org/error-index.html" rel="noreferrer">the Error Index</a>:</p>
  <blockquote>
  <h2>E0034</h2>
  <p>The compiler doesn't know what method to call because more than one method has the same prototype.</p>
  </blockquote>
  
  <blockquote>
  <h2>E0580</h2>
  <p>The <code>main</code> function was incorrectly declared. The <code>main</code> function prototype should never take arguments.</p>
  </blockquote>
  <p>In this case, &quot;function prototype&quot; seems to mean something like &quot;function signature&quot; -- the names, arguments, and types that make up a function's external interface. This also appears to be <a href="https://en.wikipedia.org/wiki/Function_prototype" rel="noreferrer">what it means in the context of C/C++</a>. However, that doesn't seem to match the usage above; every function definition starts with the function's signature, so it wouldn't make sense to say that putting the attribute on the signature does nothing, because that's what you're doing when you're putting the attribute on a function.</p>
  <p>What does the term &quot;function prototype&quot; mean in the context of Rust?</p>