title: How to initialize top-level constants with other constants?
body: <p>I'd like to initialize some top-level constants using <code>float::consts::pi</code>. For example:</p>
  
  <pre><code>import float::consts::pi;
  
  const pi2:float = pi*pi;
  
  fn main() {
      io::println(#fmt("pi^2=%.4f", pi2));
  }
  </code></pre>
  
  <p>I get these errors:</p>
  
  <pre><code>pi2.rs:3:18: 3:20 error: constant contains unimplemented expression type
  pi2.rs:3 const pi2:float = pi*pi;
                             ^~
  pi2.rs:3:21: 3:23 error: constant contains unimplemented expression type
  pi2.rs:3 const pi2:float = pi*pi;
                               ^~
  </code></pre>
  
  <p>Compilation is successful if I write:</p>
  
  <pre><code>const pi2:float = 3.14*3.14;
  </code></pre>
  
  <p>But it is not if I define my own <code>pi</code>:</p>
  
  <pre><code>const pi:float = 3.141592653589793;
  const pi2:float = pi*pi;
  </code></pre>
  
  <p>I'm using rust-0.2.</p>
  
  <p><strong>Update</strong>. Messages in rust-0.3.1 are friendlier, and confirm that the feature is not implemented yet. Referencing same-crate constants is <a href="https://github.com/mozilla/rust/issues/570" rel="nofollow">now allowed</a>:</p>
  
  <pre><code>$ rustc pi2.rs
  pi2.rs:2:18: 2:20 error: paths in constants may only refer to crate-local constants
  pi2.rs:2 const pi2:float = pi*pi;
                             ^~
  pi2.rs:2:21: 2:23 error: paths in constants may only refer to crate-local constants
  pi2.rs:2 const pi2:float = pi*pi;
                                ^~
  error: internal compiler error: unexpected failure
  note: the compiler hit an unexpected failure path. this is a bug
  note: try running with RUST_LOG=rustc=0,::rt::backtrace to get further details and report the results to github.com/mozilla/rust/issues
  </code></pre>