<p dir="auto">The sort functions currently require a pure comparison function. Is this actually required?</p>
<p dir="auto">For example, I need to be able to sort the results of a query where the results are not always orderable. If the comparison functions are allowed to be impure then I can add a <code class="notranslate">err: @mut ~str</code> argument to my function and see if it is set when the sort finishes. But if purity is required then I'll need to do a pass before the sort which is a) duplicating a traversal that sort has to do anyway and b) very inefficient (especially given that queries can have lots of results).</p>
<p dir="auto">When building current rust master, the following warning is emitted (non-fatal)</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="rustc: x86_64-unknown-linux-gnu/stage0/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_typeck
../src/librustc_typeck/astconv.rs:1565:17: 1566:79 warning: diagnostic code E0045 already used
../src/librustc_typeck/astconv.rs:1565                 span_err!(tcx.sess, ast_ty.span, E0045,
../src/librustc_typeck/astconv.rs:1566                           &quot;variadic function must have C calling convention&quot;);
../src/librustc_typeck/check/mod.rs:688:13: 701:14 note: previous invocation
../src/librustc_typeck/check/mod.rs:688             for item in &amp;m.items {
../src/librustc_typeck/check/mod.rs:689                 let pty = ccx.tcx.lookup_item_type(local_def(item.id));
../src/librustc_typeck/check/mod.rs:690                 if !pty.generics.types.is_empty() {
../src/librustc_typeck/check/mod.rs:691                     span_err!(ccx.tcx.sess, item.span, E0044,
../src/librustc_typeck/check/mod.rs:692                         &quot;foreign items may not have type parameters&quot;);
../src/librustc_typeck/check/mod.rs:693                 }
"><pre class="notranslate"><code class="notranslate">rustc: x86_64-unknown-linux-gnu/stage0/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_typeck
../src/librustc_typeck/astconv.rs:1565:17: 1566:79 warning: diagnostic code E0045 already used
../src/librustc_typeck/astconv.rs:1565                 span_err!(tcx.sess, ast_ty.span, E0045,
../src/librustc_typeck/astconv.rs:1566                           "variadic function must have C calling convention");
../src/librustc_typeck/check/mod.rs:688:13: 701:14 note: previous invocation
../src/librustc_typeck/check/mod.rs:688             for item in &amp;m.items {
../src/librustc_typeck/check/mod.rs:689                 let pty = ccx.tcx.lookup_item_type(local_def(item.id));
../src/librustc_typeck/check/mod.rs:690                 if !pty.generics.types.is_empty() {
../src/librustc_typeck/check/mod.rs:691                     span_err!(ccx.tcx.sess, item.span, E0044,
../src/librustc_typeck/check/mod.rs:692                         "foreign items may not have type parameters");
../src/librustc_typeck/check/mod.rs:693                 }

</code></pre></div>