title: Inmutable and Mutable borrows in a call to "const" method for a "const" parameter
body: <p>I can't understand why Rust complains (&quot;<em>can't borrow as immutable because also borrowed as mutable</em>&quot;) in this code (even considering that <code>.len()</code> is a &quot;constant/harmless&quot; function):</p>
  <pre><code>fn main() {
      
      let mut xs1: [i32; 5] = [ 10, 20, 30, 40, 50];
  
      let (slice1, slice2) = xs1.split_at_mut( (xs1.len()/2) ); // &lt;----- ERROR
  
      println!( &quot;{:?}&quot;, slice1 );
      println!( &quot;{:?}&quot;, slice2 );
  
      
  
  } // ()
  </code></pre>
  <p>While the split version is fine:</p>
  <pre><code>let aux = xs1.len()/2;
  let (slice1, slice2) = xs1.split_at_mut( aux );
  </code></pre>
  <p>What's the rationale here?</p>
  <p>Maybe I'm wrong but I always regarded both expressions as &quot;mathematically equivalent&quot; so to say. Not only <code>len()</code> should be a <code>const</code> method but also the input param for <code>split_at_mut()</code> should be <code>const</code> (in C++ parlance).</p>
  <p>Still holding <a href="https://stackoverflow.com/questions/20478664/cannot-borrow-foo-as-immutable-because-it-is-also-borrowed-as-mutable?rq=1">this question</a> eight years later?</p>