<p dir="auto">This code fails to compile:</p>
<div class="highlight highlight-source-rust notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="fn main() {
    let x = vec![1i, 2, 3];
    let _x = x;
    println!(&quot;{}&quot;, x);
}"><pre class="notranslate"><span class="pl-k">fn</span> <span class="pl-en">main</span><span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
    <span class="pl-k">let</span> x = <span class="pl-en">vec</span><span class="pl-en">!</span><span class="pl-kos">[</span><span class="pl-c1">1</span>i, <span class="pl-c1">2</span>, <span class="pl-c1">3</span><span class="pl-kos">]</span><span class="pl-kos">;</span>
    <span class="pl-k">let</span> _x = x<span class="pl-kos">;</span>
    <span class="pl-en">println</span><span class="pl-en">!</span><span class="pl-kos">(</span><span class="pl-s">"{}"</span>, x<span class="pl-kos">)</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span></pre></div>
<p dir="auto"><a href="http://is.gd/Lsa68z" rel="nofollow">Error</a>:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="&lt;anon&gt;:4:20: 4:21 error: use of moved value: `x`
&lt;anon&gt;:4     println!(&quot;{}&quot;, x);
                            ^
note: in expansion of format_args!
&lt;std macros&gt;:2:23: 2:77 note: expansion site
&lt;std macros&gt;:1:1: 3:2 note: in expansion of println!
&lt;anon&gt;:4:5: 4:23 note: expansion site
&lt;anon&gt;:3:9: 3:11 note: `x` moved here because it has type `collections::vec::Vec&lt;int&gt;`, which is moved by default (use `ref` to override)
&lt;anon&gt;:3     let _x = x;
                 ^~"><pre class="notranslate"><code class="notranslate">&lt;anon&gt;:4:20: 4:21 error: use of moved value: `x`
&lt;anon&gt;:4     println!("{}", x);
                            ^
note: in expansion of format_args!
&lt;std macros&gt;:2:23: 2:77 note: expansion site
&lt;std macros&gt;:1:1: 3:2 note: in expansion of println!
&lt;anon&gt;:4:5: 4:23 note: expansion site
&lt;anon&gt;:3:9: 3:11 note: `x` moved here because it has type `collections::vec::Vec&lt;int&gt;`, which is moved by default (use `ref` to override)
&lt;anon&gt;:3     let _x = x;
                 ^~
</code></pre></div>
<p dir="auto">Where as this compiles with no error:</p>
<div class="highlight highlight-source-rust notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="fn main() {
    let x = vec![1i, 2, 3];
    let _ = x;
    println!(&quot;{}&quot;, x);
}"><pre class="notranslate"><span class="pl-k">fn</span> <span class="pl-en">main</span><span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
    <span class="pl-k">let</span> x = <span class="pl-en">vec</span><span class="pl-en">!</span><span class="pl-kos">[</span><span class="pl-c1">1</span>i, <span class="pl-c1">2</span>, <span class="pl-c1">3</span><span class="pl-kos">]</span><span class="pl-kos">;</span>
    <span class="pl-k">let</span> _ = x<span class="pl-kos">;</span>
    <span class="pl-en">println</span><span class="pl-en">!</span><span class="pl-kos">(</span><span class="pl-s">"{}"</span>, x<span class="pl-kos">)</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span></pre></div>
<p dir="auto"><a href="http://is.gd/DYLy8u" rel="nofollow">Output</a>:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="[1, 2, 3]"><pre class="notranslate"><code class="notranslate">[1, 2, 3]
</code></pre></div>
<p dir="auto">(Using rustc 1.0.0-nightly (<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/rust-lang/rust/commit/1d00c545ede609b9d43fdf9f252c15da5a66dac7/hovercard" href="https://github.com/rust-lang/rust/commit/1d00c545ede609b9d43fdf9f252c15da5a66dac7"><tt>1d00c54</tt></a> 2015-01-30 19:56:34 +0000))</p>
<p dir="auto">Program using an external crate which uses "regex!" builds normally, but upon execution:<br>
"target/rss_client: error while loading shared libraries: libregex_macros-fdf5a2d7af19fd78.so: cannot open shared object file: No such file or directory"</p>
<p dir="auto">The desired .so file is in target/deps, and the executable doesn't look there unless I set LD_LIBRARY_PATH.  Then the program runs.</p>
<p dir="auto">But why is "regex" in a .so file? Here's my target/deps directory:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="libchrono-2760812556f7a811.rlib
libcookie-4a08a2c06bb5c4fc.rlib
libgcc-3361713823cacea0.rlib
libhyper-9e6a74d72671a096.rlib
liblibc-6b537f2898b2a028.rlib
liblog-b7487854e865255d.rlib
libmatches-68db25b520030534.rlib
libmime-115ca8125c42dc12.rlib
libmucell-178e4fc583386697.rlib
libopenssl-ff2380beb920b0db.rlib
libopenssl-sys-1d498ee6f4e8d500.rlib
libpkg-config-be6313c85913bcf0.rlib
libregex-50925f1e98b93309.rlib
libregex_macros-fdf5a2d7af19fd78.so &lt;---- How did that get in there?
librustc-serialize-181d5959361aa206.rlib
libtime-2215e3ac75eaa2c7.rlib
libunicase-88de2458e97b894d.rlib
libunsafe-any-3f018797a3613438.rlib
liburl-4c384fb33b0bde93.rlib
libxml-25cb934bf93db2fd.rlib"><pre class="notranslate"><code class="notranslate">libchrono-2760812556f7a811.rlib
libcookie-4a08a2c06bb5c4fc.rlib
libgcc-3361713823cacea0.rlib
libhyper-9e6a74d72671a096.rlib
liblibc-6b537f2898b2a028.rlib
liblog-b7487854e865255d.rlib
libmatches-68db25b520030534.rlib
libmime-115ca8125c42dc12.rlib
libmucell-178e4fc583386697.rlib
libopenssl-ff2380beb920b0db.rlib
libopenssl-sys-1d498ee6f4e8d500.rlib
libpkg-config-be6313c85913bcf0.rlib
libregex-50925f1e98b93309.rlib
libregex_macros-fdf5a2d7af19fd78.so &lt;---- How did that get in there?
librustc-serialize-181d5959361aa206.rlib
libtime-2215e3ac75eaa2c7.rlib
libunicase-88de2458e97b894d.rlib
libunsafe-any-3f018797a3613438.rlib
liburl-4c384fb33b0bde93.rlib
libxml-25cb934bf93db2fd.rlib
</code></pre></div>
<p dir="auto">Everything else is statically linked, and normally nothing in the "deps" directory is needed for execution. Why did "cargo build" generate a ".so" file? Did someone build "regex" as a dynamic library by mistake? I've been looking at the relevant .toml files for something that would cause this, but I'm not finding it.</p>
<p dir="auto">Where is static vs. dynamic library generation under Cargo control documented, anyway? Not finding anything in "<a href="http://doc.crates.io/guide.html" rel="nofollow">http://doc.crates.io/guide.html</a>". Obviously there's something somewhere which says "make this a shared library". But where?</p>
<p dir="auto">Again, the program works if LD_LIBRARY_PATH includes the directory with that .so file.</p>